File: fix-python-bindings.patch

package info (click to toggle)
ball 1.5.0%2Bgit20220524.d85d2dd-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 240,916 kB
  • sloc: cpp: 326,154; ansic: 4,212; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 336; javascript: 164; makefile: 102
file content (647 lines) | stat: -rw-r--r-- 20,017 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
Description: modernize python bindings for python3
Author: Étienne Mollier <emollier@debian.org>
Forwarded: no
Last-Update: 2021-12-15
Comment: Deactivated since python3 package is removed

---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- ball.orig/source/PYTHON/pyCAPIKernel.C
+++ ball/source/PYTHON/pyCAPIKernel.C
@@ -78,14 +78,14 @@
 		if(type)
 		{
 			auto name  = PyObject_GetAttrString(type, "__name__");
-			auto sname = name ? PyString_AsString(name) : nullptr;
+			auto sname = name ? PyBytes_AsString(name) : nullptr;
 			if(sname)  err << sname << ": ";
 			Py_DecRef(name);
 			Py_DecRef(type);
 		}
 
 		// error message
-		auto svalue = value ? PyString_AsString(value) : nullptr;
+		auto svalue = value ? PyBytes_AsString(value) : nullptr;
 		err << (svalue ? svalue : "(no error message given)");
 		Py_DecRef(value);
 
@@ -121,7 +121,7 @@
 		auto cio = PyObject_GetAttrString(main_module_, "__BALL_CIO");
 		auto cio_val = PyObject_GetAttrString(cio, "getvalue");
 		auto cio_f = PyObject_CallFunction(cio_val, nullptr);
-		auto ret = std::make_pair<bool, string>(true, PyString_AsString(cio_f));
+		auto ret = std::make_pair<bool, string>(true, PyBytes_AsString(cio_f));
 		Py_DecRef(cio_f);
 		Py_DecRef(cio_val);
 		Py_DecRef(cio);
@@ -177,7 +177,7 @@
 
 		for (const auto& pair: args)
 		{
-			auto val = PyString_FromString(pair.second.c_str());
+			auto val = PyBytes_FromString(pair.second.c_str());
 			if (!val)
 			{
 				Log.error() << "[PyInterpreter] Could not create parameter "
@@ -217,7 +217,7 @@
 			return nullptr;
 		}
 
-		auto mod_name = PyString_FromString(name.c_str());
+		auto mod_name = PyBytes_FromString(name.c_str());
 
 		PyObject* module = nullptr;
 		if (PyDict_Contains(module_dict, mod_name))
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/PDBAtom.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/PDBAtom.sip
@@ -48,7 +48,7 @@
 	virtual bool isValid() const throw();
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("PDBAtom ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("PDBAtom ") + sipCpp->getName()
 		+ " { " + sipCpp->getElement().getSymbol() + " @ ("
 		+ String(sipCpp->getPosition().x) + " " + String(sipCpp->getPosition().y) + " "
 		+ String(sipCpp->getPosition().z) + " }").c_str());
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/angle.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/angle.sip
@@ -46,6 +46,6 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(sipCpp->toRadian()).c_str());
+	sipRes = PyBytes_FromString(String(sipCpp->toRadian()).c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/atom.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/atom.sip
@@ -7,11 +7,11 @@
 	public:
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
-		return PyInt_Check(sipPy) || BALL_CAN_CONVERT_TO_INSTANCE(sipPy, Atom);
+		return PyLong_Check(sipPy) || BALL_CAN_CONVERT_TO_INSTANCE(sipPy, Atom);
 
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
-		*sipCppPtr = new AtomType(PyInt_AS_LONG(sipPy));
+		*sipCppPtr = new AtomType(PyLong_AS_LONG(sipPy));
 
 		return 1;
 	}
@@ -23,12 +23,12 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(*sipCpp).c_str());
+	sipRes = PyBytes_FromString(String(*sipCpp).c_str());
 %End
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(*sipCpp).c_str());
+	sipRes = PyBytes_FromString(String(*sipCpp).c_str());
 %End
 };
 
@@ -148,7 +148,7 @@
 	// convert the atom to a string representation
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Atom ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Atom ") + sipCpp->getName()
 		+ " { " + sipCpp->getElement().getSymbol() + " @ ("
 		+ String(sipCpp->getPosition().x) + " " + String(sipCpp->getPosition().y) + " "
 		+ String(sipCpp->getPosition().z) + ") }").c_str());
@@ -156,7 +156,7 @@
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Atom ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Atom ") + sipCpp->getName()
 		+ " { " + sipCpp->getElement().getSymbol() + " @ ("
 		+ String(sipCpp->getPosition().x) + " " + String(sipCpp->getPosition().y) + " "
 		+ String(sipCpp->getPosition().z) + " }").c_str());
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/atomContainer.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/atomContainer.sip
@@ -69,7 +69,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("AtomContainer ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("AtomContainer ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/bond.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/bond.sip
@@ -103,6 +103,6 @@
 		}
 		tmp += " }";
 	}
-	return PyString_FromString(tmp.c_str());
+	return PyBytes_FromString(tmp.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/box3.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/box3.sip
@@ -29,6 +29,6 @@
 	tmp += String(sipCpp->getPoint().x) + " ";
 	tmp += String(sipCpp->getPoint().y) + " ";
 	tmp += String(sipCpp->getPoint().z) + ") }";
-	sipRes = PyString_FromString(tmp.c_str());
+	sipRes = PyBytes_FromString(tmp.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/chain.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/chain.sip
@@ -44,7 +44,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Chain ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Chain ") + sipCpp->getName()
 						+ " { " + String(sipCpp->countResidues()) + " residues }").c_str());
 %End
 
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/file.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/file.sip
@@ -66,16 +66,16 @@
 		case (int)std::ios::in: 		mode_string = "std::ios::in"; break;
 		default:										mode_string = "";
 	}
-	sipRes = PyString_FromString(mode_string);
+	sipRes = PyBytes_FromString(mode_string);
 %End
 
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
-		return (PyInt_Check(sipPy) || BALL_IS_SUBCLASS_INSTANCE(sipPy, OpenMode));
+		return (PyLong_Check(sipPy) || BALL_IS_SUBCLASS_INSTANCE(sipPy, OpenMode));
 
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
-		int mode = PyInt_AS_LONG(sipPy);
+		int mode = PyLong_AS_LONG(sipPy);
 		File::OpenMode result;
 		switch (mode)
 		{
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/fragment.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/fragment.sip
@@ -18,7 +18,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Fragment ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Fragment ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/molecule.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/molecule.sip
@@ -40,7 +40,7 @@
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Molecule ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Molecule ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/nucleicAcid.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/nucleicAcid.sip
@@ -27,14 +27,14 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("NucleicAcid ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("NucleicAcid ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countNucleotides()) + " nucleotides,  "
 		+ String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("NucleicAcid ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("NucleicAcid ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countNucleotides()) + " nucleotides,  "
 		+ String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/options.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/options.sip
@@ -38,7 +38,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Options ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Options ") + sipCpp->getName()
 		+ " { " + String(sipCpp->getSize()) + " entries }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/peptideBuilder.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/peptideBuilder.sip
@@ -22,7 +22,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString((String("{ ") + sipCpp->getType() + " " +
+	sipRes = PyBytes_FromString((String("{ ") + sipCpp->getType() + " " +
 		String(sipCpp->getPhi().toDegree()) + " " +
 		String(sipCpp->getPsi().toDegree()) + " " +
 		String(sipCpp->getOmega().toDegree()) + " }").c_str());
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/property.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/property.sip
@@ -25,7 +25,7 @@
 %MethodCode
 	if(sipCpp == 0)
 	{
-		sipRes = PyString_FromString("");
+		sipRes = PyBytes_FromString("");
 	}
 	else
 	{
@@ -60,7 +60,7 @@
 				output += BALL::String("Smart Object, Value: ") + BALL::String((unsigned long) &*sipCpp->getSmartObject());
 				break;
 		}
-		sipRes = PyString_FromString(output.c_str());
+		sipRes = PyBytes_FromString(output.c_str());
 	}
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/protein.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/protein.sip
@@ -54,7 +54,7 @@
 
   SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Protein ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("Protein ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countResidues()) + " residues }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/residue.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/residue.sip
@@ -67,7 +67,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("Residue ") + sipCpp->getName() + sipCpp->getID()
+	sipRes = PyBytes_FromString(String(String("Residue ") + sipCpp->getName() + sipCpp->getID()
 		+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/secondaryStructure.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/secondaryStructure.sip
@@ -49,13 +49,13 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	return PyString_FromString(String(String("SecondaryStructure ") + sipCpp->getName()
+	return PyBytes_FromString(String(String("SecondaryStructure ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countResidues()) + " residues }").c_str());
 %End
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	return PyString_FromString(String(String("SecondaryStructure ") + sipCpp->getName()
+	return PyBytes_FromString(String(String("SecondaryStructure ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countResidues()) + " residues }").c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/simpleBox3.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/simpleBox3.sip
@@ -40,6 +40,6 @@
 	tmp += String(sipCpp->b.x) + " ";
 	tmp += String(sipCpp->b.y) + " ";
 	tmp += String(sipCpp->b.z) + ") }";
-	sipRes = PyString_FromString(tmp.c_str());
+	sipRes = PyBytes_FromString(tmp.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/string.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/string.sip
@@ -166,11 +166,11 @@
 %MethodCode
 	if (sipCpp == 0)
 	{
-		sipRes = PyString_FromString("");
+		sipRes = PyBytes_FromString("");
 	}
 	else
 	{
-		sipRes = PyString_FromString(sipCpp->c_str());
+		sipRes = PyBytes_FromString(sipCpp->c_str());
 	}
 %End
 
@@ -178,17 +178,17 @@
 %MethodCode
 	if (sipCpp == 0)
 	{
-		sipRes = PyString_FromString("");
+		sipRes = PyBytes_FromString("");
 	}
 	else
 	{
-		sipRes = PyString_FromString(sipCpp->c_str());
+		sipRes = PyBytes_FromString(sipCpp->c_str());
 	}
 %End
 
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
-		return (PyString_Check(sipPy) || BALL_IS_SUBCLASS_INSTANCE(sipPy, String));
+		return (PyBytes_Check(sipPy) || BALL_IS_SUBCLASS_INSTANCE(sipPy, String));
 
 	if (sipPy == Py_None)
 	{
@@ -196,9 +196,9 @@
 		return 1;
 	}
 
-	if (PyString_Check(sipPy))
+	if (PyBytes_Check(sipPy))
 	{
-		*sipCppPtr = new String(PyString_AS_STRING(sipPy));
+		*sipCppPtr = new String(PyBytes_AS_STRING(sipPy));
 		return 1;
 	}
 
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/system.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/system.sip
@@ -67,7 +67,7 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("System ") + sipCpp->getName()
+	sipRes = PyBytes_FromString(String(String("System ") + sipCpp->getName()
 		+ " { " + String(sipCpp->countMolecules()) + " molecules,  "
 		+ String(sipCpp->countAtoms()) + " atoms }").c_str());
 %End
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/timeStamp.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/timeStamp.sip
@@ -30,7 +30,7 @@
 	String usec_str(sipCpp->getMicroSeconds() / 1.0e6);
 	time_str.append(usec_str.after("."));
 
-	sipRes = PyString_FromString(time_str.c_str());
+	sipRes = PyBytes_FromString(time_str.c_str());
 %End
 };
 
@@ -61,6 +61,6 @@
 	String usec_str(sipCpp->getTime().getMicroSeconds() / 1.0e6);
 	time_str.append(usec_str.after("."));
 
-	sipRes = PyString_FromString(time_str.c_str());
+	sipRes = PyBytes_FromString(time_str.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/vector2.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/vector2.sip
@@ -56,6 +56,6 @@
 	tmp = "(";
 	tmp += String(sipCpp->x) + " ";
 	tmp += String(sipCpp->y) + ")";
-	sipRes = PyString_FromString(tmp.c_str());
+	sipRes = PyBytes_FromString(tmp.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/vector3.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/vector3.sip
@@ -66,6 +66,6 @@
 	tmp += String(sipCpp->x) + " ";
 	tmp += String(sipCpp->y) + " ";
 	tmp += String(sipCpp->z) + ")";
-	sipRes = PyString_FromString(tmp.c_str());
+	sipRes = PyBytes_FromString(tmp.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/version.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/version.sip
@@ -21,6 +21,6 @@
 
 	SIP_PYOBJECT __str__();
 %MethodCode
-	return PyString_FromString(VersionInfo::getVersion());
+	return PyBytes_FromString(VersionInfo::getVersion());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/VIEW/colorRGBA.sip
+++ ball/source/PYTHON/EXTENSIONS/VIEW/colorRGBA.sip
@@ -43,7 +43,7 @@
 	String s("ColorRGBA {");
 	s += (String) *sipCpp;
 	s += " }";
-	sipRes = PyString_FromString(s.c_str());
+	sipRes = PyBytes_FromString(s.c_str());
 %End
 
 	SIP_PYOBJECT __repr__();
@@ -51,6 +51,6 @@
 	String s("ColorRGBA {");
 	s += (String) *sipCpp;
 	s += " }";
-	sipRes = PyString_FromString(s.c_str());
+	sipRes = PyBytes_FromString(s.c_str());
 %End
 };
--- ball.orig/source/PYTHON/EXTENSIONS/VIEW/geometricObject.sip
+++ ball/source/PYTHON/EXTENSIONS/VIEW/geometricObject.sip
@@ -61,7 +61,7 @@
 	// convert to a string representation
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("GeometricObject")
+	sipRes = PyBytes_FromString(String(String("GeometricObject")
 		+ " { "
 		+ " Composite: " + String((long int)sipCpp->getComposite())
 		+ " }").c_str());
@@ -69,7 +69,7 @@
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("GeometricObject")
+	sipRes = PyBytes_FromString(String(String("GeometricObject")
 		+ " { "
 		+ " Composite: " + String((long int)sipCpp->getComposite())
 		+ " }").c_str());
--- ball.orig/source/PYTHON/EXTENSIONS/VIEW/gridVisualisation.sip
+++ ball/source/PYTHON/EXTENSIONS/VIEW/gridVisualisation.sip
@@ -38,7 +38,7 @@
 	// convert to a string representation
 	SIP_PYOBJECT __str__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("GridVisualisation ")
+	sipRes = PyBytes_FromString(String(String("GridVisualisation ")
 		+ " { "
 		+ "   Grid: " + String((long int)sipCpp->getGrid())
 		+ "   Texture: " + String(sipCpp->getTexture())
@@ -47,7 +47,7 @@
 
 	SIP_PYOBJECT __repr__();
 %MethodCode
-	sipRes = PyString_FromString(String(String("GridVisualisation ")
+	sipRes = PyBytes_FromString(String(String("GridVisualisation ")
 		+ " { "
 		+ "   Grid: " + String((long int)sipCpp->getGrid())
 		+ "   Texture: " + String(sipCpp->getTexture())
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/global.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/global.sip
@@ -7,12 +7,12 @@
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
 	{
-		return PyInt_Check(sipPy);
+		return PyLong_Check(sipPy);
 	}
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
 		*sipCppPtr = new Index;
-		**sipCppPtr = PyInt_AsLong(sipPy);
+		**sipCppPtr = PyLong_AsLong(sipPy);
 
 		return 1;
 	}
@@ -22,9 +22,9 @@
 %ConvertFromTypeCode
 	if (sipCpp == NULL)
 	{
-		return PyInt_FromLong(0);
+		return PyLong_FromLong(0);
 	}
-	return PyInt_FromLong(*sipCpp);
+	return PyLong_FromLong(*sipCpp);
 %End
 };
 
@@ -36,12 +36,12 @@
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
 	{
-		return PyInt_Check(sipPy);
+		return PyLong_Check(sipPy);
 	}
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
 		*sipCppPtr = new Position;
-		**sipCppPtr = PyInt_AsLong(sipPy);
+		**sipCppPtr = PyLong_AsLong(sipPy);
 
 		return 1;
 	}
@@ -51,9 +51,9 @@
 %ConvertFromTypeCode
 	if (sipCpp == NULL)
 	{
-		return PyInt_FromLong(0);
+		return PyLong_FromLong(0);
 	}
-	return PyInt_FromLong(*sipCpp);
+	return PyLong_FromLong(*sipCpp);
 %End
 };
 
@@ -66,12 +66,12 @@
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
 	{
-		return PyInt_Check(sipPy);
+		return PyLong_Check(sipPy);
 	}
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
 		*sipCppPtr = new LongIndex;
-		**sipCppPtr = PyInt_AsLong(sipPy);
+		**sipCppPtr = PyLong_AsLong(sipPy);
 
 		return 1;
 	}
@@ -81,9 +81,9 @@
 %ConvertFromTypeCode
 	if (sipCpp == NULL)
 	{
-		return PyInt_FromLong(0);
+		return PyLong_FromLong(0);
 	}
-	return PyInt_FromLong(*sipCpp);
+	return PyLong_FromLong(*sipCpp);
 %End
 };
 
@@ -96,12 +96,12 @@
 %ConvertToTypeCode
 	if (sipIsErr == NULL)
 	{
-		return PyInt_Check(sipPy);
+		return PyLong_Check(sipPy);
 	}
-	if (PyInt_Check(sipPy))
+	if (PyLong_Check(sipPy))
 	{
 		*sipCppPtr = new Time;
-		**sipCppPtr = PyInt_AsLong(sipPy);
+		**sipCppPtr = PyLong_AsLong(sipPy);
 
 		return 1;
 	}
@@ -111,9 +111,9 @@
 %ConvertFromTypeCode
 	if (sipCpp == NULL)
 	{
-		return PyInt_FromLong(0);
+		return PyLong_FromLong(0);
 	}
-	return PyInt_FromLong(*sipCpp);
+	return PyLong_FromLong(*sipCpp);
 %End
 };
 
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/pair.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/pair.sip
@@ -165,8 +165,8 @@
 	if ((t = PyTuple_New(2)) == NULL)
 		return NULL;
 
-		PyTuple_SET_ITEM(t, 0, PyInt_FromLong(sipCpp->first));
-		PyTuple_SET_ITEM(t, 1, PyInt_FromLong(sipCpp->second));
+		PyTuple_SET_ITEM(t, 0, PyLong_FromLong(sipCpp->first));
+		PyTuple_SET_ITEM(t, 1, PyLong_FromLong(sipCpp->second));
 
 	return t;
 %End
@@ -184,7 +184,7 @@
 	std::pair<Position,Position>* result = 0;
 
 	if(!*sipIsErr) {
-		result = new std::pair<Position, Position>(PyInt_AsLong(PyNumber_Int(PyTuple_GET_ITEM(sipPy, 0))), PyInt_AsLong(PyNumber_Int(PyTuple_GET_ITEM(sipPy, 1))));
+		result = new std::pair<Position, Position>(PyLong_AsLong(PyNumber_Int(PyTuple_GET_ITEM(sipPy, 0))), PyLong_AsLong(PyNumber_Int(PyTuple_GET_ITEM(sipPy, 1))));
 	}
 
 
--- ball.orig/source/PYTHON/EXTENSIONS/BALL/pyIndexList.sip
+++ ball/source/PYTHON/EXTENSIONS/BALL/pyIndexList.sip
@@ -15,7 +15,7 @@
 	// Convert the list.
 	for (PyIndexList::ConstIterator it = sipCpp->begin(); it != sipCpp->end(); ++it)
 	{
-		if (PyList_Append(pl, PyInt_FromLong(*it)) < 0)
+		if (PyList_Append(pl, PyLong_FromLong(*it)) < 0)
 		{
 			Py_DECREF(pl);
 			return NULL;
@@ -38,7 +38,7 @@
 
 	for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
 	{
-		Index index = PyInt_AsLong(PyList_GET_ITEM(sipPy,i));
+		Index index = PyLong_AsLong(PyList_GET_ITEM(sipPy,i));
 		index_list -> push_back(index);
 	}