Skip to content

Commit

Permalink
Merge pull request #1011 from Thrameos/ssize_t
Browse files Browse the repository at this point in the history
Fix for ssize_t issue on windows
  • Loading branch information
marscher authored Nov 2, 2021
2 parents 9c210eb + 9325d37 commit 77b2aff
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 45 deletions.
18 changes: 9 additions & 9 deletions .azure/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ variables:
jobs:
- job: Deps
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/ivy.yml

- job: Documentation
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/documentation.yml

- job: Coverage
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
dependsOn: Deps
steps:
- template: scripts/deps.yml
- template: scripts/coverage.yml

- job: Tracing
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/tracing.yml

Expand All @@ -51,19 +51,19 @@ jobs:
strategy:
matrix:
linux-3.5:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.5'
linux-3.6:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.6'
linux-3.7:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.7'
linux-3.8:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.8'
linux-3.9:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.9'
windows-3.5:
imageName: "vs2017-win2016"
Expand Down
3 changes: 3 additions & 0 deletions doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o

Latest Changes:
- **1.3.1_dev0 - 2021-06-05**

- Fixed issue with ssize_t on Windows for Python 3.10.

- **1.3.0 - 2021-05-19**

- Fixes for memory issues found when upgrading to Python 3.10 beta.
Expand Down
4 changes: 2 additions & 2 deletions native/common/include/jp_booleantype.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class JPBooleanType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -94,4 +94,4 @@ class JPBooleanType : public JPPrimitiveType

} ;

#endif // _JP_BOOLEAN_TYPE_H_
#endif // _JP_BOOLEAN_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_bytetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class JPByteType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -100,4 +100,4 @@ class JPByteType : public JPPrimitiveType
static const jlong _Byte_Max = -128;
} ;

#endif // _JPBYTE_TYPE_H_
#endif // _JPBYTE_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_chartype.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class JPCharType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -90,4 +90,4 @@ class JPCharType : public JPPrimitiveType

} ;

#endif // _JP-CHAR_TYPE_H_
#endif // _JP-CHAR_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_doubletype.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class JPDoubleType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -93,4 +93,4 @@ class JPDoubleType : public JPPrimitiveType
JPPyBuffer& view, int subs, int base, jobject dims) override;
} ;

#endif // _JP_DOUBLE_TYPE_H_
#endif // _JP_DOUBLE_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_floattype.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class JPFloatType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -94,4 +94,4 @@ class JPFloatType : public JPPrimitiveType

} ;

#endif // _JP_FLOAT_TYPE_H_
#endif // _JP_FLOAT_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_inttype.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class JPIntType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -99,4 +99,4 @@ class JPIntType : public JPPrimitiveType

} ;

#endif // _JP_INT_TYPE_H_
#endif // _JP_INT_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_longtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class JPLongType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -98,4 +98,4 @@ class JPLongType : public JPPrimitiveType

} ;

#endif // _JP_LONG_TYPE_H_
#endif // _JP_LONG_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_primitivetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JPPrimitiveType : public JPClass
virtual void getView(JPArrayView& view) = 0;
virtual void releaseView(JPArrayView& view) = 0;
virtual const char* getBufferFormat() = 0;
virtual ssize_t getItemSize() = 0;
virtual Py_ssize_t getItemSize() = 0;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) = 0;
Expand All @@ -53,4 +53,4 @@ class JPPrimitiveType : public JPClass
PyObject *convertLong(PyTypeObject* wrapper, PyLongObject* tmp);
} ;

#endif
#endif
4 changes: 2 additions & 2 deletions native/common/include/jp_shorttype.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class JPShortType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
Expand All @@ -98,4 +98,4 @@ class JPShortType : public JPPrimitiveType

} ;

#endif // _JP_SHORT_TYPE_H_
#endif // _JP_SHORT_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/include/jp_voidtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class JPVoidType : public JPPrimitiveType
virtual void getView(JPArrayView& view) override;
virtual void releaseView(JPArrayView& view) override;
virtual const char* getBufferFormat() override;
virtual ssize_t getItemSize() override;
virtual Py_ssize_t getItemSize() override;
virtual void copyElements(JPJavaFrame &frame,
jarray a, jsize start, jsize len,
void* memory, int offset) override;
virtual PyObject *newMultiArray(JPJavaFrame &frame,
JPPyBuffer& view, int subs, int base, jobject dims) override;
} ;

#endif // _JP_VOID_TYPE_H_
#endif // _JP_VOID_TYPE_H_
4 changes: 2 additions & 2 deletions native/common/jp_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ JPArrayView::JPArrayView(JPArray* array, jobject collection)
// Second element is the shape of the array from which we compute the
// memory size, the shape, and strides
int dims;
ssize_t itemsize;
ssize_t sz;
Py_ssize_t itemsize;
Py_ssize_t sz;
{
JPPrimitiveArrayAccessor<jintArray, jint*> accessor(frame, (jintArray) item1,
&JPJavaFrame::GetIntArrayElements, &JPJavaFrame::ReleaseIntArrayElements);
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_booleantype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const char* JPBooleanType::getBufferFormat()
return "?";
}

ssize_t JPBooleanType::getItemSize()
Py_ssize_t JPBooleanType::getItemSize()
{
return sizeof (jboolean);
}
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_bytetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ const char* JPByteType::getBufferFormat()
return "b";
}

ssize_t JPByteType::getItemSize()
Py_ssize_t JPByteType::getItemSize()
{
return sizeof (jbyte);
}
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_chartype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const char* JPCharType::getBufferFormat()
return "H";
}

ssize_t JPCharType::getItemSize()
Py_ssize_t JPCharType::getItemSize()
{
return sizeof (jchar);
}
Expand Down
1 change: 0 additions & 1 deletion native/common/jp_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ void JPClass::getConversionInfo(JPConversionInfo &info)
JP_TRACE_OUT;
}


//</editor-fold>
//<editor-fold desc="hierarchy" defaultstate="collapsed">

Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_doubletype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const char* JPDoubleType::getBufferFormat()
return "d";
}

ssize_t JPDoubleType::getItemSize()
Py_ssize_t JPDoubleType::getItemSize()
{
return sizeof (jdouble);
}
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_floattype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ const char* JPFloatType::getBufferFormat()
return "f";
}

ssize_t JPFloatType::getItemSize()
Py_ssize_t JPFloatType::getItemSize()
{
return sizeof (jfloat);
}
Expand Down
4 changes: 2 additions & 2 deletions native/common/jp_gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ void JPGarbageCollection::onEnd()
}

// Predict if we will cross the limit soon.
ssize_t pred = current + 2 * (current - last);
Py_ssize_t pred = current + 2 * (current - last);
last = current;
if ((ssize_t) pred > (ssize_t) limit)
if ((Py_ssize_t) pred > (Py_ssize_t) limit)
run_gc = 2;

// printf("consider gc %d (%ld, %ld, %ld, %ld) %ld\n", run_gc,
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_inttype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const char* JPIntType::getBufferFormat()
return "i";
}

ssize_t JPIntType::getItemSize()
Py_ssize_t JPIntType::getItemSize()
{
return sizeof (jfloat);
}
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_longtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ const char* JPLongType::getBufferFormat()
return "q";
}

ssize_t JPLongType::getItemSize()
Py_ssize_t JPLongType::getItemSize()
{
return sizeof (jlong);
}
Expand Down
2 changes: 1 addition & 1 deletion native/common/jp_shorttype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const char* JPShortType::getBufferFormat()
return "h";
}

ssize_t JPShortType::getItemSize()
Py_ssize_t JPShortType::getItemSize()
{
return sizeof (jshort);
}
Expand Down
4 changes: 2 additions & 2 deletions native/common/jp_voidtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const char* JPVoidType::getBufferFormat()
return NULL;
}

ssize_t JPVoidType::getItemSize()
Py_ssize_t JPVoidType::getItemSize()
{
return 0;
}
Expand Down Expand Up @@ -154,4 +154,4 @@ PyObject *JPVoidType::newMultiArray(JPJavaFrame &frame,
return NULL;
}

// GCOVR_EXCL_STOP
// GCOVR_EXCL_STOP
2 changes: 1 addition & 1 deletion native/python/include/jp_pythontypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class JPPyObjectVector
return m_Contents.size();
}

PyObject* operator[](ssize_t i)
PyObject* operator[](Py_ssize_t i)
{
return m_Contents[i].get();
}
Expand Down

0 comments on commit 77b2aff

Please sign in to comment.