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

Skip to content

Commit 2bc8ff6

Browse files
committed
Merge branch 'v1.0.x'
2 parents c3c73cc + cb609d5 commit 2bc8ff6

6 files changed

Lines changed: 35 additions & 27 deletions

File tree

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
@@ -110,7 +110,7 @@ Py::Object
110110
BufferRegion::set_x(const Py::Tuple &args)
111111
{
112112
args.verify_length(1);
113-
size_t x = Py::Int(args[0]);
113+
size_t x = (long) Py::Int(args[0]);
114114
rect.x1 = x;
115115
return Py::Object();
116116
}
@@ -120,7 +120,7 @@ Py::Object
120120
BufferRegion::set_y(const Py::Tuple &args)
121121
{
122122
args.verify_length(1);
123-
size_t y = Py::Int(args[0]);
123+
size_t y = (long)Py::Int(args[0]);
124124
rect.y1 = y;
125125
return Py::Object();
126126
}
@@ -1736,16 +1736,16 @@ RendererAgg::draw_quad_mesh(const Py::Tuple& args)
17361736

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

17501750
QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates.ptr());
17511751

src/_image.cpp

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

671671
args.verify_length(1);
672672

673-
size_t method = Py::Int(args[0]);
673+
size_t method = (long)Py::Int(args[0]);
674674
interpolation = (unsigned)method;
675675
return Py::Object();
676676
}
@@ -704,7 +704,7 @@ Image::set_aspect(const Py::Tuple& args)
704704
_VERBOSE("Image::set_aspect");
705705

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

@@ -758,8 +758,8 @@ _image_module::from_images(const Py::Tuple& args)
758758

759759
args.verify_length(3);
760760

761-
size_t numrows = (size_t)Py::Int(args[0]);
762-
size_t numcols = (size_t)Py::Int(args[1]);
761+
size_t numrows = (long)Py::Int(args[0]);
762+
size_t numcols = (long)Py::Int(args[1]);
763763

764764
if (numrows >= 32768 || numcols >= 32768)
765765
{
@@ -802,8 +802,8 @@ _image_module::from_images(const Py::Tuple& args)
802802
{
803803
tup = Py::Tuple(tups[imnum]);
804804
Image* thisim = static_cast<Image*>(tup[0].ptr());
805-
ox = Py::Int(tup[1]);
806-
oy = Py::Int(tup[2]);
805+
ox = (long)Py::Int(tup[1]);
806+
oy = (long)Py::Int(tup[2]);
807807
bool isflip = (thisim->rbufOut->stride()) < 0;
808808
//std::cout << "from images " << isflip << "; stride=" << thisim->rbufOut->stride() << std::endl;
809809
size_t ind = 0;
@@ -1224,8 +1224,8 @@ _image_module::frombuffer(const Py::Tuple& args)
12241224
args.verify_length(4);
12251225

12261226
PyObject *bufin = new_reference_to(args[0]);
1227-
size_t x = Py::Int(args[1]);
1228-
size_t y = Py::Int(args[2]);
1227+
size_t x = (long)Py::Int(args[1]);
1228+
size_t y = (long)Py::Int(args[2]);
12291229

12301230
if (x >= 32768 || y >= 32768)
12311231
{

0 commit comments

Comments
 (0)