Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb609d5

Browse files
committed
Merge branch 'CTPUG-32bit_compile_fixes' into v1.0.x
2 parents bed5241 + 7327d13 commit cb609d5

File tree

6 files changed

+35
-27
lines changed

6 files changed

+35
-27
lines changed

CXX/Python3/Config.hxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,12 @@
107107
# define TEMPLATE_TYPENAME class
108108
#endif
109109

110+
111+
/* Need to fudge Py_hash_t types for python > 3.2 */
112+
113+
#if PY_VERSION_HEX < 0x030200A4
114+
typedef long Py_hash_t;
115+
typedef unsigned long Py_uhash_t;
116+
#endif
117+
110118
#endif // __PyCXX_config_hh__

CXX/Python3/ExtensionTypeBase.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace Py
8383
virtual Object rich_compare( const Object &, int );
8484
virtual Object repr();
8585
virtual Object str();
86-
virtual long hash();
86+
virtual Py_hash_t hash();
8787
virtual Object call( const Object &, const Object & );
8888
virtual Object iter();
8989
virtual PyObject *iternext();

CXX/Python3/Objects.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ namespace Py
270270
return Object( PyObject_GetItem( p, *key ), true );
271271
}
272272

273-
long hashValue() const
273+
Py_hash_t hashValue() const
274274
{
275275
return PyObject_Hash( p );
276276
}
@@ -1159,7 +1159,7 @@ namespace Py
11591159
return the_item.getItem( key );
11601160
}
11611161

1162-
long hashValue() const
1162+
Py_hash_t hashValue() const
11631163
{
11641164
return the_item.hashValue();
11651165
}
@@ -2417,7 +2417,7 @@ namespace Py
24172417
return the_item.getItem( k );
24182418
}
24192419

2420-
long hashValue() const
2420+
Py_hash_t hashValue() const
24212421
{
24222422
return the_item.hashValue();
24232423
}

CXX/Python3/cxx_extensions.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ extern "C"
225225
static PyObject *rich_compare_handler( PyObject *, PyObject *, int );
226226
static PyObject *repr_handler( PyObject * );
227227
static PyObject *str_handler( PyObject * );
228-
static long hash_handler( PyObject * );
228+
static Py_hash_t hash_handler( PyObject * );
229229
static PyObject *call_handler( PyObject *, PyObject *, PyObject * );
230230
static PyObject *iter_handler( PyObject * );
231231
static PyObject *iternext_handler( PyObject * );
@@ -714,7 +714,7 @@ extern "C" PyObject *str_handler( PyObject *self )
714714
}
715715
}
716716

717-
extern "C" long hash_handler( PyObject *self )
717+
extern "C" Py_hash_t hash_handler( PyObject *self )
718718
{
719719
try
720720
{
@@ -1191,7 +1191,7 @@ Py::Object PythonExtensionBase::str()
11911191
return Py::None();
11921192
}
11931193

1194-
long PythonExtensionBase::hash()
1194+
Py_hash_t PythonExtensionBase::hash()
11951195
{
11961196
missing_method( hash );
11971197
return -1; }

src/_backend_agg.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Py::Object
108108
BufferRegion::set_x(const Py::Tuple &args)
109109
{
110110
args.verify_length(1);
111-
size_t x = Py::Int(args[0]);
111+
size_t x = (long) Py::Int(args[0]);
112112
rect.x1 = x;
113113
return Py::Object();
114114
}
@@ -118,7 +118,7 @@ Py::Object
118118
BufferRegion::set_y(const Py::Tuple &args)
119119
{
120120
args.verify_length(1);
121-
size_t y = Py::Int(args[0]);
121+
size_t y = (long)Py::Int(args[0]);
122122
rect.y1 = y;
123123
return Py::Object();
124124
}
@@ -1734,16 +1734,16 @@ RendererAgg::draw_quad_mesh(const Py::Tuple& args)
17341734

17351735
//segments, trans, clipbox, colors, linewidths, antialiaseds
17361736
GCAgg gc(args[0], dpi);
1737-
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr());
1738-
size_t mesh_width = Py::Int(args[2]);
1739-
size_t mesh_height = Py::Int(args[3]);
1740-
Py::Object coordinates = args[4];
1741-
Py::Object offsets_obj = args[5];
1742-
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[6].ptr());
1743-
Py::Object facecolors_obj = args[7];
1744-
bool antialiased = (bool)Py::Int(args[8]);
1745-
bool showedges = (bool)Py::Int(args[9]);
1746-
bool free_edgecolors = false;
1737+
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr());
1738+
size_t mesh_width = (long)Py::Int(args[2]);
1739+
size_t mesh_height = (long)Py::Int(args[3]);
1740+
Py::Object coordinates = args[4];
1741+
Py::Object offsets_obj = args[5];
1742+
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[6].ptr());
1743+
Py::Object facecolors_obj = args[7];
1744+
bool antialiased = (bool)Py::Boolean(args[8]);
1745+
bool showedges = (bool)Py::Boolean(args[9]);
1746+
bool free_edgecolors = false;
17471747

17481748
QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates.ptr());
17491749

src/_image.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ Image::set_interpolation(const Py::Tuple& args)
668668

669669
args.verify_length(1);
670670

671-
size_t method = Py::Int(args[0]);
671+
size_t method = (long)Py::Int(args[0]);
672672
interpolation = (unsigned)method;
673673
return Py::Object();
674674
}
@@ -702,7 +702,7 @@ Image::set_aspect(const Py::Tuple& args)
702702
_VERBOSE("Image::set_aspect");
703703

704704
args.verify_length(1);
705-
size_t method = Py::Int(args[0]);
705+
size_t method = (long)Py::Int(args[0]);
706706
aspect = (unsigned)method;
707707
return Py::Object();
708708

@@ -756,8 +756,8 @@ _image_module::from_images(const Py::Tuple& args)
756756

757757
args.verify_length(3);
758758

759-
size_t numrows = (size_t)Py::Int(args[0]);
760-
size_t numcols = (size_t)Py::Int(args[1]);
759+
size_t numrows = (long)Py::Int(args[0]);
760+
size_t numcols = (long)Py::Int(args[1]);
761761

762762
if (numrows >= 32768 || numcols >= 32768)
763763
{
@@ -800,8 +800,8 @@ _image_module::from_images(const Py::Tuple& args)
800800
{
801801
tup = Py::Tuple(tups[imnum]);
802802
Image* thisim = static_cast<Image*>(tup[0].ptr());
803-
ox = Py::Int(tup[1]);
804-
oy = Py::Int(tup[2]);
803+
ox = (long)Py::Int(tup[1]);
804+
oy = (long)Py::Int(tup[2]);
805805
bool isflip = (thisim->rbufOut->stride()) < 0;
806806
//std::cout << "from images " << isflip << "; stride=" << thisim->rbufOut->stride() << std::endl;
807807
size_t ind = 0;
@@ -1171,8 +1171,8 @@ _image_module::frombuffer(const Py::Tuple& args)
11711171
args.verify_length(4);
11721172

11731173
PyObject *bufin = new_reference_to(args[0]);
1174-
size_t x = Py::Int(args[1]);
1175-
size_t y = Py::Int(args[2]);
1174+
size_t x = (long)Py::Int(args[1]);
1175+
size_t y = (long)Py::Int(args[2]);
11761176

11771177
if (x >= 32768 || y >= 32768)
11781178
{

0 commit comments

Comments
 (0)