Cython 3.3.0a1__py3-none-any.whl → 3.3.0a2.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Cython/Compiler/ModuleNode.py +7 -4
- Cython/Includes/cpython/array.pxd +5 -5
- Cython/Shadow.py +1 -1
- Cython/Utility/AsyncGen.c +4 -6
- Cython/Utility/Coroutine.c +4 -0
- Cython/Utility/CythonFunction.c +97 -13
- Cython/Utility/ExtensionTypes.c +28 -0
- Cython/Utility/arrayarray.h +18 -16
- cython-3.3.0a2.dev0.dist-info/METADATA +74 -0
- {cython-3.3.0a1.dist-info → cython-3.3.0a2.dev0.dist-info}/RECORD +13 -13
- cython-3.3.0a1.dist-info/METADATA +0 -394
- {cython-3.3.0a1.dist-info → cython-3.3.0a2.dev0.dist-info}/WHEEL +0 -0
- {cython-3.3.0a1.dist-info → cython-3.3.0a2.dev0.dist-info}/entry_points.txt +0 -0
- {cython-3.3.0a1.dist-info → cython-3.3.0a2.dev0.dist-info}/top_level.txt +0 -0
Cython/Compiler/ModuleNode.py
CHANGED
|
@@ -2196,14 +2196,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
|
|
|
2196
2196
|
if not entry or not entry.is_special:
|
|
2197
2197
|
return
|
|
2198
2198
|
|
|
2199
|
+
code.globalstate.use_utility_code(
|
|
2200
|
+
UtilityCode.load_cached("DeallocKeepAlive", "ExtensionTypes.c"))
|
|
2199
2201
|
code.putln("{")
|
|
2200
2202
|
code.putln("PyObject *etype, *eval, *etb;")
|
|
2201
2203
|
code.putln("__Pyx_PyErr_FetchException(&etype, &eval, &etb);")
|
|
2202
|
-
#
|
|
2203
|
-
#
|
|
2204
|
-
|
|
2204
|
+
# Keep the object alive while we are calling into user code, to prevent
|
|
2205
|
+
# the user code from triggering recursive deallocation. On free-threading
|
|
2206
|
+
# this must not use Py_SET_REFCNT() (see DeallocKeepAlive in ExtensionTypes.c).
|
|
2207
|
+
code.putln("__Pyx_DeallocKeepAliveBegin(o);")
|
|
2205
2208
|
code.putln("%s(o);" % entry.func_cname)
|
|
2206
|
-
code.putln("
|
|
2209
|
+
code.putln("__Pyx_DeallocKeepAliveEnd(o);")
|
|
2207
2210
|
code.putln("__Pyx_PyErr_RestoreException(etype, eval, etb);")
|
|
2208
2211
|
code.putln("}")
|
|
2209
2212
|
|
|
@@ -122,23 +122,23 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
|
|
|
122
122
|
if zero is true, new array will be initialized with zeroes."""
|
|
123
123
|
cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
|
|
124
124
|
if zero and op is not None:
|
|
125
|
-
memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
|
|
125
|
+
memset(op.data.as_chars, 0, <size_t> length * <size_t> op.ob_descr.itemsize)
|
|
126
126
|
return op
|
|
127
127
|
|
|
128
128
|
cdef inline array copy(array self):
|
|
129
129
|
""" make a copy of an array. """
|
|
130
130
|
cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
|
|
131
|
-
memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
|
|
131
|
+
memcpy(op.data.as_chars, self.data.as_chars, <size_t> Py_SIZE(op) * <size_t> op.ob_descr.itemsize)
|
|
132
132
|
return op
|
|
133
133
|
|
|
134
134
|
cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
|
|
135
135
|
""" efficient appending of new stuff of same type
|
|
136
136
|
(e.g. of same array type)
|
|
137
137
|
n: number of elements (not number of bytes!) """
|
|
138
|
-
cdef
|
|
138
|
+
cdef size_t itemsize = <size_t> self.ob_descr.itemsize
|
|
139
139
|
cdef Py_ssize_t origsize = Py_SIZE(self)
|
|
140
140
|
resize_smart(self, origsize + n)
|
|
141
|
-
memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
|
|
141
|
+
memcpy(self.data.as_chars + <size_t> origsize * itemsize, stuff, <size_t> n * itemsize)
|
|
142
142
|
return 0
|
|
143
143
|
|
|
144
144
|
cdef inline int extend(array self, array other) except -1:
|
|
@@ -149,4 +149,4 @@ cdef inline int extend(array self, array other) except -1:
|
|
|
149
149
|
|
|
150
150
|
cdef inline void zero(array self) noexcept:
|
|
151
151
|
""" set all elements of array to zero. """
|
|
152
|
-
memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
|
|
152
|
+
memset(self.data.as_chars, 0, <size_t> Py_SIZE(self) * <size_t> self.ob_descr.itemsize)
|
Cython/Shadow.py
CHANGED
Cython/Utility/AsyncGen.c
CHANGED
|
@@ -45,12 +45,13 @@ if (likely(__pyx_AsyncGen_init($module_cname) == 0)); else
|
|
|
45
45
|
//@requires: Coroutine.c::Coroutine
|
|
46
46
|
|
|
47
47
|
#define __Pyx_AsyncGen_USED
|
|
48
|
+
|
|
48
49
|
typedef struct {
|
|
49
50
|
__pyx_CoroutineObject coro;
|
|
50
51
|
PyObject *ag_finalizer;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
char ag_hooks_inited;
|
|
53
|
+
char ag_closed;
|
|
54
|
+
char ag_running_async;
|
|
54
55
|
} __pyx_PyAsyncGenObject;
|
|
55
56
|
|
|
56
57
|
#define __Pyx_AsyncGen_CheckExact(obj) Py_IS_TYPE(obj, CGLOBAL(__pyx_AsyncGenType))
|
|
@@ -352,8 +353,6 @@ static PyGetSetDef __Pyx_async_gen_getsetlist[] = {
|
|
|
352
353
|
PyDoc_STR("name of the async generator"), 0},
|
|
353
354
|
{"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
|
|
354
355
|
PyDoc_STR("qualified name of the async generator"), 0},
|
|
355
|
-
//REMOVED: {(char*) "ag_await", (getter)coro_get_cr_await, NULL,
|
|
356
|
-
//REMOVED: (char*) PyDoc_STR("object being awaited on, or None")},
|
|
357
356
|
{0, 0, 0, 0, 0} /* Sentinel */
|
|
358
357
|
};
|
|
359
358
|
|
|
@@ -361,7 +360,6 @@ static PyMemberDef __Pyx_async_gen_memberlist[] = {
|
|
|
361
360
|
//REMOVED: {(char*) "ag_frame", T_OBJECT, offsetof(__pyx_PyAsyncGenObject, ag_frame), READONLY},
|
|
362
361
|
{"ag_running", T_BOOL, offsetof(__pyx_PyAsyncGenObject, ag_running_async), READONLY, NULL},
|
|
363
362
|
//REMOVED: {(char*) "ag_code", T_OBJECT, offsetof(__pyx_PyAsyncGenObject, ag_code), READONLY},
|
|
364
|
-
//ADDED: "ag_await"
|
|
365
363
|
{"ag_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
|
|
366
364
|
PyDoc_STR("object being awaited on, or None")},
|
|
367
365
|
{"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
|
Cython/Utility/Coroutine.c
CHANGED
|
@@ -1676,6 +1676,10 @@ static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
|
|
|
1676
1676
|
Py_XINCREF(code);
|
|
1677
1677
|
gen->gi_code = code;
|
|
1678
1678
|
gen->gi_frame = NULL;
|
|
1679
|
+
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
|
|
1680
|
+
memset(gen->$monitoring_states_cname, 0, sizeof(gen->$monitoring_states_cname));
|
|
1681
|
+
gen->$monitoring_version_cname = 0;
|
|
1682
|
+
#endif
|
|
1679
1683
|
|
|
1680
1684
|
PyObject_GC_Track(gen);
|
|
1681
1685
|
return gen;
|
Cython/Utility/CythonFunction.c
CHANGED
|
@@ -254,6 +254,7 @@ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject
|
|
|
254
254
|
//@requires: Exceptions.c::IgnoreException
|
|
255
255
|
//@requires: ModuleSetupCode.c::IncludeStructmemberH
|
|
256
256
|
//@requires: ObjectHandling.c::PyObjectGetAttrStr
|
|
257
|
+
//@requires: ObjectHandling.c::PyObjectCallOneArg
|
|
257
258
|
//@requires: ExtensionTypes.c::CallTypeTraverse
|
|
258
259
|
//@requires: Synchronization.c::CriticalSections
|
|
259
260
|
//@substitute: naming
|
|
@@ -547,6 +548,8 @@ __Pyx_CyFunction_get_kwdefaults(PyObject *op, void *context) {
|
|
|
547
548
|
return result;
|
|
548
549
|
}
|
|
549
550
|
|
|
551
|
+
static int __Pyx_CyFunction_set_annotate_in_dict_if_exists(PyObject *op_in, PyObject *value); /*proto*/
|
|
552
|
+
|
|
550
553
|
static int
|
|
551
554
|
__Pyx_CyFunction_set_annotations(PyObject *op_in, PyObject* value, void *context) {
|
|
552
555
|
CYTHON_UNUSED_VAR(context);
|
|
@@ -562,9 +565,59 @@ __Pyx_CyFunction_set_annotations(PyObject *op_in, PyObject* value, void *context
|
|
|
562
565
|
__Pyx_BEGIN_CRITICAL_SECTION(op_in);
|
|
563
566
|
__Pyx_Py_XDECREF_SET(op->func_annotations, value);
|
|
564
567
|
__Pyx_END_CRITICAL_SECTION();
|
|
568
|
+
if (unlikely(__Pyx_CyFunction_set_annotate_in_dict_if_exists(op_in, Py_None) < 0)) return -1;
|
|
565
569
|
return 0;
|
|
566
570
|
}
|
|
567
571
|
|
|
572
|
+
static int
|
|
573
|
+
__Pyx_CyFunction_get_dict_if_exists(PyObject *op_in, PyObject **dict) {
|
|
574
|
+
/* Return 1 if the function dict exists, 0 otherwise. This cannot fail:
|
|
575
|
+
* _PyObject_GetDictPtr() may clear errors internally, but never reports them. */
|
|
576
|
+
#if CYTHON_COMPILING_IN_PYPY
|
|
577
|
+
*dict = PyObject_GenericGetDict(op_in, NULL);
|
|
578
|
+
#elif CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030C0000
|
|
579
|
+
*dict = __Pyx_as_CyFunctionObject(op_in)->func_dict;
|
|
580
|
+
#else
|
|
581
|
+
PyObject **dictptr = _PyObject_GetDictPtr(op_in);
|
|
582
|
+
*dict = likely(dictptr) ? *dictptr : NULL;
|
|
583
|
+
#endif
|
|
584
|
+
return *dict ? 1 : 0;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
static int
|
|
588
|
+
__Pyx_CyFunction_get_annotate_from_dict_if_exists(PyObject *op_in, PyObject **annotate) {
|
|
589
|
+
PyObject *dict;
|
|
590
|
+
int dict_found;
|
|
591
|
+
*annotate = NULL;
|
|
592
|
+
dict_found = __Pyx_CyFunction_get_dict_if_exists(op_in, &dict);
|
|
593
|
+
if (!dict_found) return 0;
|
|
594
|
+
return __Pyx_PyDict_GetItemRef(dict, PYIDENT("__annotate__"), annotate);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
static int
|
|
598
|
+
__Pyx_CyFunction_set_annotate_in_dict_if_exists(PyObject *op_in, PyObject *value) {
|
|
599
|
+
PyObject *dict;
|
|
600
|
+
int dict_found;
|
|
601
|
+
dict_found = __Pyx_CyFunction_get_dict_if_exists(op_in, &dict);
|
|
602
|
+
if (!dict_found) return 0;
|
|
603
|
+
return PyDict_SetItem(dict, PYIDENT("__annotate__"), value);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
static int
|
|
607
|
+
__Pyx_CyFunction_set_annotate_in_dict(PyObject *op_in, PyObject *value) {
|
|
608
|
+
PyObject *dict;
|
|
609
|
+
int result;
|
|
610
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
611
|
+
dict = __Pyx_CyFunction_get_dict(__Pyx_as_CyFunctionObject(op_in), NULL);
|
|
612
|
+
#else
|
|
613
|
+
dict = PyObject_GenericGetDict(op_in, NULL);
|
|
614
|
+
#endif
|
|
615
|
+
if (unlikely(!dict)) return -1;
|
|
616
|
+
result = PyDict_SetItem(dict, PYIDENT("__annotate__"), value);
|
|
617
|
+
Py_DECREF(dict);
|
|
618
|
+
return result;
|
|
619
|
+
}
|
|
620
|
+
|
|
568
621
|
static PyObject *
|
|
569
622
|
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
|
|
570
623
|
PyObject* result = op->func_annotations;
|
|
@@ -579,16 +632,43 @@ __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
|
|
|
579
632
|
|
|
580
633
|
static PyObject *
|
|
581
634
|
__Pyx_CyFunction_get_annotations(PyObject *op_in, void *context) {
|
|
582
|
-
PyObject *
|
|
635
|
+
PyObject *annotate = NULL;
|
|
636
|
+
PyObject *result = NULL;
|
|
583
637
|
__pyx_CyFunctionObject *op = __Pyx_as_CyFunctionObject(op_in);
|
|
584
638
|
CYTHON_UNUSED_VAR(context);
|
|
585
639
|
__Pyx_BEGIN_CRITICAL_SECTION(op_in);
|
|
586
|
-
result =
|
|
640
|
+
result = __Pyx_XNewRef(op->func_annotations);
|
|
641
|
+
__Pyx_END_CRITICAL_SECTION();
|
|
642
|
+
if (result) return result;
|
|
643
|
+
|
|
644
|
+
if (unlikely(__Pyx_CyFunction_get_annotate_from_dict_if_exists(op_in, &annotate) < 0)) return NULL;
|
|
645
|
+
if (!annotate || annotate == Py_None) {
|
|
646
|
+
Py_XDECREF(annotate);
|
|
647
|
+
__Pyx_BEGIN_CRITICAL_SECTION(op_in);
|
|
648
|
+
result = __Pyx_CyFunction_get_annotations_locked(op);
|
|
649
|
+
__Pyx_END_CRITICAL_SECTION();
|
|
650
|
+
return result;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
PyObject *format = PyLong_FromLong(1L); // annotationlib.Format.VALUE
|
|
654
|
+
if (likely(format)) {
|
|
655
|
+
result = __Pyx_PyObject_CallOneArg(annotate, format);
|
|
656
|
+
Py_DECREF(format);
|
|
657
|
+
}
|
|
658
|
+
Py_DECREF(annotate);
|
|
659
|
+
if (unlikely(!result)) return NULL;
|
|
660
|
+
if (unlikely(!PyDict_Check(result))) {
|
|
661
|
+
PyErr_SetString(PyExc_TypeError, "__annotate__ must return a dict");
|
|
662
|
+
Py_DECREF(result);
|
|
663
|
+
return NULL;
|
|
664
|
+
}
|
|
665
|
+
__Pyx_BEGIN_CRITICAL_SECTION(op_in);
|
|
666
|
+
__Pyx_Py_XDECREF_SET(op->func_annotations, __Pyx_NewRef(result));
|
|
587
667
|
__Pyx_END_CRITICAL_SECTION();
|
|
588
668
|
return result;
|
|
589
669
|
}
|
|
590
670
|
|
|
591
|
-
static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self,
|
|
671
|
+
static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self,
|
|
592
672
|
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
593
673
|
PyObject *args
|
|
594
674
|
#else
|
|
@@ -622,11 +702,13 @@ static PyMethodDef __Pyx_CyFunction_annotate_method = {
|
|
|
622
702
|
|
|
623
703
|
// We don't yet support PEP649 properly, so __annotate__ is
|
|
624
704
|
// implemented in a minimal way, just so that functools.wraps works.
|
|
625
|
-
// Essentially the effect of doing func.__annotate__ = other.__annotate__
|
|
626
|
-
// is to copy the annotations dictionary.
|
|
627
705
|
static PyObject *
|
|
628
706
|
__Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) {
|
|
707
|
+
PyObject *annotate = NULL;
|
|
629
708
|
CYTHON_UNUSED_VAR(context);
|
|
709
|
+
if (unlikely(__Pyx_CyFunction_get_annotate_from_dict_if_exists(op_in, &annotate) < 0)) return NULL;
|
|
710
|
+
if (annotate) return annotate;
|
|
711
|
+
|
|
630
712
|
PyObject *annotations = __Pyx_CyFunction_get_annotations(op_in, NULL);
|
|
631
713
|
if (unlikely(!annotations)) return NULL;
|
|
632
714
|
PyObject *method = PyCFunction_New(
|
|
@@ -643,15 +725,17 @@ __Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) {
|
|
|
643
725
|
PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted");
|
|
644
726
|
return -1;
|
|
645
727
|
}
|
|
646
|
-
if (value
|
|
647
|
-
|
|
648
|
-
return
|
|
728
|
+
if (unlikely(value != Py_None && !PyCallable_Check(value))) {
|
|
729
|
+
PyErr_SetString(PyExc_TypeError, "__annotate__ must be callable or None");
|
|
730
|
+
return -1;
|
|
649
731
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
732
|
+
if (value != Py_None) {
|
|
733
|
+
__pyx_CyFunctionObject *op = __Pyx_as_CyFunctionObject(op_in);
|
|
734
|
+
__Pyx_BEGIN_CRITICAL_SECTION(op_in);
|
|
735
|
+
Py_CLEAR(op->func_annotations);
|
|
736
|
+
__Pyx_END_CRITICAL_SECTION();
|
|
737
|
+
}
|
|
738
|
+
return __Pyx_CyFunction_set_annotate_in_dict(op_in, value);
|
|
655
739
|
}
|
|
656
740
|
|
|
657
741
|
#if __PYX_LIMITED_VERSION_HEX < 0x030B0000
|
Cython/Utility/ExtensionTypes.c
CHANGED
|
@@ -295,6 +295,34 @@ static int __Pyx_PyType_Ready(PyTypeObject *t) {
|
|
|
295
295
|
#define __Pyx_TRASHCAN_END
|
|
296
296
|
#endif
|
|
297
297
|
|
|
298
|
+
/////////////// DeallocKeepAlive.proto ///////////////
|
|
299
|
+
|
|
300
|
+
// Keep `o` alive across a call into user __dealloc__ code, to prevent the user
|
|
301
|
+
// code from triggering recursive deallocation, then drop the temporary reference.
|
|
302
|
+
//
|
|
303
|
+
// On the GIL build this is a plain refcount bump. On free-threading we must NOT
|
|
304
|
+
// use Py_SET_REFCNT(o, 1): the object reaching tp_dealloc is unowned and merged
|
|
305
|
+
// (ob_ref_shared == _Py_REF_MERGED), so Py_SET_REFCNT takes the unowned branch and
|
|
306
|
+
// writes ob_ref_shared = _Py_REF_SHARED(1, _Py_REF_MERGED), i.e. "merged, shared
|
|
307
|
+
// count 1" -- indistinguishable from a live object. A concurrent
|
|
308
|
+
// PyUnstable_TryIncRef() would then succeed and resurrect the dying object
|
|
309
|
+
// (use-after-free). Instead we mirror CPython's _PyObject_ResurrectStart/End:
|
|
310
|
+
// re-take ownership and keep the *shared* refcount at the refuse sentinel (0), so
|
|
311
|
+
// the bump is invisible to other threads and TryIncRef keeps refusing.
|
|
312
|
+
|
|
313
|
+
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
|
|
314
|
+
#define __Pyx_DeallocKeepAliveBegin(o) do { \
|
|
315
|
+
_Py_atomic_store_uintptr_relaxed(&(o)->ob_tid, _Py_ThreadId()); \
|
|
316
|
+
_Py_atomic_store_uint32_relaxed(&(o)->ob_ref_local, 1); \
|
|
317
|
+
_Py_atomic_store_ssize_relaxed(&(o)->ob_ref_shared, 0); \
|
|
318
|
+
} while (0)
|
|
319
|
+
#define __Pyx_DeallocKeepAliveEnd(o) \
|
|
320
|
+
_Py_atomic_store_uint32_relaxed(&(o)->ob_ref_local, 0)
|
|
321
|
+
#else
|
|
322
|
+
#define __Pyx_DeallocKeepAliveBegin(o) Py_SET_REFCNT(o, Py_REFCNT(o) + 1)
|
|
323
|
+
#define __Pyx_DeallocKeepAliveEnd(o) Py_SET_REFCNT(o, Py_REFCNT(o) - 1)
|
|
324
|
+
#endif
|
|
325
|
+
|
|
298
326
|
/////////////// CallNextTpDealloc.proto ///////////////
|
|
299
327
|
|
|
300
328
|
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
|
Cython/Utility/arrayarray.h
CHANGED
|
@@ -81,9 +81,9 @@ static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t si
|
|
|
81
81
|
return NULL;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
nbytes = size * descr->itemsize;
|
|
84
|
+
nbytes = (size_t) size * (size_t) descr->itemsize;
|
|
85
85
|
// Check for overflow
|
|
86
|
-
if (nbytes / descr->itemsize != (size_t)size) {
|
|
86
|
+
if (nbytes / (size_t) descr->itemsize != (size_t) size) {
|
|
87
87
|
return PyErr_NoMemory();
|
|
88
88
|
}
|
|
89
89
|
op = (arrayobject *) type->tp_alloc(type, 0);
|
|
@@ -128,7 +128,7 @@ static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
|
|
|
128
128
|
return GraalPyArray_Resize((PyObject*)self, n);
|
|
129
129
|
#else
|
|
130
130
|
void *items = (void*) self->data.ob_item;
|
|
131
|
-
PyMem_Resize(items, char, (size_t)
|
|
131
|
+
PyMem_Resize(items, char, (size_t) n * (size_t) self->ob_descr->itemsize);
|
|
132
132
|
if (items == NULL) {
|
|
133
133
|
PyErr_NoMemory();
|
|
134
134
|
return -1;
|
|
@@ -146,25 +146,27 @@ static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
|
|
|
146
146
|
return GraalPyArray_Resize((PyObject*)self, n);
|
|
147
147
|
#else
|
|
148
148
|
void *items = (void*) self->data.ob_item;
|
|
149
|
-
|
|
150
|
-
if (
|
|
149
|
+
size_t newsize, requested_size = (size_t) n;
|
|
150
|
+
if (requested_size < (size_t) self->allocated && requested_size > (size_t) self->allocated / 4) {
|
|
151
151
|
Py_SET_SIZE(self, n);
|
|
152
152
|
return 0;
|
|
153
153
|
}
|
|
154
|
-
newsize =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
PyMem_Resize(items, char, (size_t)
|
|
160
|
-
if (items == NULL)
|
|
161
|
-
|
|
162
|
-
return -1;
|
|
163
|
-
}
|
|
154
|
+
newsize = requested_size + (requested_size / 2) + 1U;
|
|
155
|
+
/* check for overflow */
|
|
156
|
+
if (newsize <= requested_size || newsize >= (size_t) PY_SSIZE_T_MAX / (size_t) self->ob_descr->itemsize)
|
|
157
|
+
goto no_memory;
|
|
158
|
+
|
|
159
|
+
PyMem_Resize(items, char, newsize * (size_t) self->ob_descr->itemsize);
|
|
160
|
+
if (items == NULL)
|
|
161
|
+
goto no_memory;
|
|
164
162
|
self->data.ob_item = (char*) items;
|
|
165
163
|
Py_SET_SIZE(self, n);
|
|
166
|
-
self->allocated = newsize;
|
|
164
|
+
self->allocated = (Py_ssize_t) newsize;
|
|
167
165
|
return 0;
|
|
166
|
+
|
|
167
|
+
no_memory:
|
|
168
|
+
PyErr_NoMemory();
|
|
169
|
+
return -1;
|
|
168
170
|
#endif
|
|
169
171
|
}
|
|
170
172
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Cython
|
|
3
|
+
Version: 3.3.0a2.dev0
|
|
4
|
+
Summary: The Cython compiler for writing C extensions in the Python language.
|
|
5
|
+
Home-page: https://cython.org/
|
|
6
|
+
Author: Robert Bradshaw, Stefan Behnel, David Woods, Greg Ewing, et al.
|
|
7
|
+
Author-email: cython-devel@python.org
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Documentation, https://cython.readthedocs.io/
|
|
10
|
+
Project-URL: Donate, https://cython.readthedocs.io/en/latest/src/donating.html
|
|
11
|
+
Project-URL: Source Code, https://github.com/cython/cython
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/cython/cython/issues/
|
|
13
|
+
Project-URL: User Group, https://groups.google.com/g/cython-users
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
27
|
+
Classifier: Programming Language :: C
|
|
28
|
+
Classifier: Programming Language :: C++
|
|
29
|
+
Classifier: Programming Language :: Cython
|
|
30
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
31
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
32
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
|
+
Classifier: Typing :: Typed
|
|
34
|
+
Requires-Python: >=3.9
|
|
35
|
+
Description-Content-Type: text/x-rst
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: author-email
|
|
38
|
+
Dynamic: classifier
|
|
39
|
+
Dynamic: description
|
|
40
|
+
Dynamic: description-content-type
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: project-url
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
Dynamic: summary
|
|
46
|
+
|
|
47
|
+
The Cython language makes writing C extensions for the Python language as
|
|
48
|
+
easy as Python itself. Cython is a source code translator based on Pyrex_,
|
|
49
|
+
but supports more cutting edge functionality and optimizations.
|
|
50
|
+
|
|
51
|
+
The Cython language is a superset of the Python language (almost all Python
|
|
52
|
+
code is also valid Cython code), but Cython additionally supports optional
|
|
53
|
+
static typing to natively call C functions, operate with C++ classes and
|
|
54
|
+
declare fast C types on variables and class attributes. This allows the
|
|
55
|
+
compiler to generate very efficient C code from Cython code.
|
|
56
|
+
|
|
57
|
+
This makes Cython the ideal language for writing glue code for external
|
|
58
|
+
C/C++ libraries, and for fast C modules that speed up the execution of
|
|
59
|
+
Python code.
|
|
60
|
+
|
|
61
|
+
The newest Cython release can always be downloaded from https://cython.org/.
|
|
62
|
+
Unpack the tarball or zip file, enter the directory, and then run::
|
|
63
|
+
|
|
64
|
+
pip install .
|
|
65
|
+
|
|
66
|
+
Note that for one-time builds, e.g. for CI/testing, on platforms that are not
|
|
67
|
+
covered by one of the wheel packages provided on PyPI *and* the pure Python wheel
|
|
68
|
+
that we provide is not used, it is substantially faster than a full source build
|
|
69
|
+
to install an uncompiled (slower) version of Cython with::
|
|
70
|
+
|
|
71
|
+
NO_CYTHON_COMPILE=true pip install .
|
|
72
|
+
|
|
73
|
+
.. _Pyrex: https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
|
|
74
|
+
|
|
@@ -3,7 +3,7 @@ Cython/CodeWriter.py,sha256=k1SAPvsjXum7dhX9IjZ3wXuDUOzzFKYEbNZSxMKEwos,24276
|
|
|
3
3
|
Cython/Coverage.py,sha256=WGY5BW1nBcJ86f4Lrs6ZZIuFKCdngsEizs4Kor0iRsc,18783
|
|
4
4
|
Cython/Debugging.py,sha256=vFtJhn7QstMf5gnYru2qHIz5ZjPg1KSlZVGHr-pBCwM,552
|
|
5
5
|
Cython/LZSS.py,sha256=wypD6hSDweKe_e-ScebyzhpYb_9E9oCP2LrfxKeTbcU,5640
|
|
6
|
-
Cython/Shadow.py,sha256=
|
|
6
|
+
Cython/Shadow.py,sha256=ThtZ7bofR6F9DTQo4b2WSIuPJZ_BYBPSCZ0gkT5CS8g,38928
|
|
7
7
|
Cython/StringIOTree.py,sha256=xg-sJreuZwfvxEZyyHpL1spF_z3aWM4nRzV_JBSlq4c,5510
|
|
8
8
|
Cython/TestUtils.py,sha256=eqUSiFBTWr2V4bT10Z0xCzknW--oOMPxE1T3AA4hxvg,16659
|
|
9
9
|
Cython/Utils.py,sha256=zG-43h0OuWH3IHydvsc8Tfky8kqybx9S4Y8_tlbq8jk,20775
|
|
@@ -50,7 +50,7 @@ Cython/Compiler/LineTable.py,sha256=epP6DoefUR7JCK9OUOyoYcxMWhBEwyTWOr3E7vJRqa4,
|
|
|
50
50
|
Cython/Compiler/Main.py,sha256=0jzmtq3Xd0HzyiUDxYnhsakqF2RMwAce2tSZN1XfK1c,34995
|
|
51
51
|
Cython/Compiler/MatchCaseNodes.py,sha256=4yxMzyP7WNk-S95A0Eca0OtCKXBJ22fHwUp0c86I5ws,85602
|
|
52
52
|
Cython/Compiler/MemoryView.py,sha256=C5FLzTauQZF47MQq6Zml5etoSequLTGgeQ7QS6qcxHs,32778
|
|
53
|
-
Cython/Compiler/ModuleNode.py,sha256=
|
|
53
|
+
Cython/Compiler/ModuleNode.py,sha256=Ikih3OJQRWp_YIBxR12aC1iHF2wChp-7d5nbgD4qPrY,208508
|
|
54
54
|
Cython/Compiler/Naming.py,sha256=I-y_gaQZMpfCOwPS3ohBCanEEScSZoySkAdrT7tn6Zg,11351
|
|
55
55
|
Cython/Compiler/Nodes.py,sha256=PCRPaIEchrg49vXhE3E-0PHsHQbdOXQ7jWm4mlaktvQ,461570
|
|
56
56
|
Cython/Compiler/Optimize.py,sha256=_h4wbm6zEiS-V9rrOQxTPu5ndZNcwZ3oqhE7sD_1es8,235010
|
|
@@ -112,7 +112,7 @@ Cython/Distutils/extension.py,sha256=hJ8VeNgGyxdz7Lke_Bg7FUkiC6mu9uNz9TosfXsfTaI
|
|
|
112
112
|
Cython/Distutils/old_build_ext.py,sha256=T-0H1lPbaP1wa_YgV9JkattbYOhHDHqQ9gsWkqYkkd0,13723
|
|
113
113
|
Cython/Includes/openmp.pxd,sha256=3GTRd5JH31CvfTzXErglXnyf_jye1Gvk9O4giTa6pc0,1712
|
|
114
114
|
Cython/Includes/cpython/__init__.pxd,sha256=dUl8RHGxo-181oczdAl7vND_jkcMaHnK4A2ji1hJaos,8100
|
|
115
|
-
Cython/Includes/cpython/array.pxd,sha256=
|
|
115
|
+
Cython/Includes/cpython/array.pxd,sha256=68uPLBvGTiKfQGJc5riQxBApYo6_USR_aceNqOitOHg,5722
|
|
116
116
|
Cython/Includes/cpython/bool.pxd,sha256=2_ouVZUNuCHLVxpNwzQ4bCExpZTj354KcQ0iRv48LZs,1358
|
|
117
117
|
Cython/Includes/cpython/buffer.pxd,sha256=wm7aHygGUof_H3-JyICOek_xiU6Oks178ark1Nfk-a0,4870
|
|
118
118
|
Cython/Includes/cpython/bytearray.pxd,sha256=00A4Jz669d43AirqCWwswlVxaykwj1f3zNgMSYOYD74,1453
|
|
@@ -267,7 +267,7 @@ Cython/Tests/TestStringIOTree.py,sha256=VJ6xbi7obugZlJ63qImRaeG0FerSs9JbBA0Kxocb
|
|
|
267
267
|
Cython/Tests/TestTestUtils.py,sha256=BOaRzxyQ_OIpSs_LVk_kOc1qw_HmPwck84MFvKwCayk,2888
|
|
268
268
|
Cython/Tests/__init__.py,sha256=jOqtmPLCvMCq0xVMwGekuLpBmVgq0xtPFmUePySdOjs,13
|
|
269
269
|
Cython/Tests/xmlrunner.py,sha256=1X79TBIYWOcZIzoylOSu9zULxVIR4xvq-RZ7f8Fn600,14612
|
|
270
|
-
Cython/Utility/AsyncGen.c,sha256=
|
|
270
|
+
Cython/Utility/AsyncGen.c,sha256=w32B8SE7acqXdvQzoO5POhCZX7s_O51Q-sXXxjzOBuw,34411
|
|
271
271
|
Cython/Utility/Buffer.c,sha256=MbklacjSbPHkfrf15-ZqqHeaX8BD6-lESqwpd__KaI0,28311
|
|
272
272
|
Cython/Utility/BufferFormatFromTypeInfo.pxd,sha256=KoGGKw7rW8Utav9xrwVZpsLX-vlpFe3Xv0hmp45PimM,97
|
|
273
273
|
Cython/Utility/Builtins.c,sha256=FcrsUxHWXEpEkwNxSPd0kJWZNi_bn8tskmWSMDjewSA,31640
|
|
@@ -275,15 +275,15 @@ Cython/Utility/CConvert.pyx,sha256=8hQnAPExrkh4HnJcMcR1VZ1ZTJeVreQRSb1lpDpJ3Q4,4
|
|
|
275
275
|
Cython/Utility/CMath.c,sha256=rP6O5u23EybDGimRCHfy8WTpyxhPu5G1F6ksEmrgKnQ,3044
|
|
276
276
|
Cython/Utility/CommonStructures.c,sha256=HOibirnL5WyYbPUthb269QTu9MYuoTt-EMsBhFRFkY4,8626
|
|
277
277
|
Cython/Utility/Complex.c,sha256=nxxtxZk74ykGPoVhkHtYAnITLWLKYNHBSs8NEEmRf38,14033
|
|
278
|
-
Cython/Utility/Coroutine.c,sha256=
|
|
278
|
+
Cython/Utility/Coroutine.c,sha256=DTCsBwK_HAeq9ekv3tkbSc2FI6hppyDXjww0wTU9eyE,85937
|
|
279
279
|
Cython/Utility/CpdefEnums.pyx,sha256=Lnsx0BqA_rxwxP4RZlMupMp4WGUF7QUC1K-hFvUsL0o,3737
|
|
280
280
|
Cython/Utility/CppConvert.pyx,sha256=onbI09dQzC6ZJxvzosS-WuvweIeh3f0rd65Xor7G3AU,7317
|
|
281
281
|
Cython/Utility/CppSupport.cpp,sha256=vR1G8qqdyLWTk4quKz5v6Z1syIMrfPldB9IzbwkYxDo,5464
|
|
282
|
-
Cython/Utility/CythonFunction.c,sha256=
|
|
282
|
+
Cython/Utility/CythonFunction.c,sha256=njyIqHAOvHL9Y1aN2rZjHWUKLDosJfjk7G9pNJCysek,74595
|
|
283
283
|
Cython/Utility/Dataclasses.c,sha256=eCa9JHHg6bj-WSKw1xTDjazghmXAkMd9J5TnELNTVOI,4023
|
|
284
284
|
Cython/Utility/Embed.c,sha256=lGOiz05yR0nQ574hqIkDHd3S-imJiVDAApH3maaH0dg,3846
|
|
285
285
|
Cython/Utility/Exceptions.c,sha256=NWAgRgl272Dt3Z--PEyJ9WPC51D-UaAlSsbmjblwpog,36603
|
|
286
|
-
Cython/Utility/ExtensionTypes.c,sha256=
|
|
286
|
+
Cython/Utility/ExtensionTypes.c,sha256=RE3ON_wNZ-JDwWnMMoyo5O9-t5A3KO49fmwuWvt-g4Q,44002
|
|
287
287
|
Cython/Utility/FunctionArguments.c,sha256=2fICNrvzp5o3nlkzgQtBSGvc1XdG_0xJ6-0PBtDg4zU,34343
|
|
288
288
|
Cython/Utility/FusedFunction.pyx,sha256=3reL7n6L2M3gU_OXSYAvoDEVVjJxMWvpiesvGmRAEc8,1494
|
|
289
289
|
Cython/Utility/ImportExport.c,sha256=XTVcbigdw8PgCWAXcxunD6OBrWKCmorhacafnokjPOY,30989
|
|
@@ -308,12 +308,12 @@ Cython/Utility/TypeConversion.c,sha256=AECBQhxO5-xMhkkn9EcgcK69zsGROT5EYGmQVN-2B
|
|
|
308
308
|
Cython/Utility/UFuncs.pyx,sha256=ZcCCNCMMfrtqsSCwN31jJ4CVOiveDyseDcpJPgAdhPk,2026
|
|
309
309
|
Cython/Utility/UFuncs_C.c,sha256=yf9apP9NQlDlBrljn6YXYpNrwb5ILjxUt96Wzz2a6LM,3203
|
|
310
310
|
Cython/Utility/__init__.py,sha256=QBJ9uZ80GHBZG-TJevWaVWgx6HobLwQkZzWog9U9rb0,1158
|
|
311
|
-
Cython/Utility/arrayarray.h,sha256=
|
|
311
|
+
Cython/Utility/arrayarray.h,sha256=j2IS9arZo9AGDqZbwhfkuy0cpGRxtjddZirDrVwQ2Y4,4974
|
|
312
312
|
pyximport/__init__.py,sha256=9hOyKolFtOerPiVEyktKrT1VtzbGexq9UmORzo52iHI,79
|
|
313
313
|
pyximport/pyxbuild.py,sha256=AsL1tyLxG61Mj7Ah-DxtDBuaXF94W2Tb6KTos7r0w8I,5702
|
|
314
314
|
pyximport/pyximport.py,sha256=BnXVwq1cwo1EYRjPU0J-RUDcwzGjUlzKWZOOMDNcu-s,18510
|
|
315
|
-
cython-3.3.
|
|
316
|
-
cython-3.3.
|
|
317
|
-
cython-3.3.
|
|
318
|
-
cython-3.3.
|
|
319
|
-
cython-3.3.
|
|
315
|
+
cython-3.3.0a2.dev0.dist-info/METADATA,sha256=1L8LkVjr6Rq511bArf5UGiVofO8ZUU3ITYs2NTN9YFI,3219
|
|
316
|
+
cython-3.3.0a2.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
317
|
+
cython-3.3.0a2.dev0.dist-info/entry_points.txt,sha256=VU8NX8gnQyFbyqiWMzfh9BHvYMuoQRS3Nbm3kKcKQeY,139
|
|
318
|
+
cython-3.3.0a2.dev0.dist-info/top_level.txt,sha256=jLV8tZV98iCbIfiJR4DVzTX5Ru1Y_pYMZ59wkMCe6SY,24
|
|
319
|
+
cython-3.3.0a2.dev0.dist-info/RECORD,,
|
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: Cython
|
|
3
|
-
Version: 3.3.0a1
|
|
4
|
-
Summary: The Cython compiler for writing C extensions in the Python language.
|
|
5
|
-
Home-page: https://cython.org/
|
|
6
|
-
Author: Robert Bradshaw, Stefan Behnel, David Woods, Greg Ewing, et al.
|
|
7
|
-
Author-email: cython-devel@python.org
|
|
8
|
-
License: Apache-2.0
|
|
9
|
-
Project-URL: Documentation, https://cython.readthedocs.io/
|
|
10
|
-
Project-URL: Donate, https://cython.readthedocs.io/en/latest/src/donating.html
|
|
11
|
-
Project-URL: Source Code, https://github.com/cython/cython
|
|
12
|
-
Project-URL: Bug Tracker, https://github.com/cython/cython/issues/
|
|
13
|
-
Project-URL: User Group, https://groups.google.com/g/cython-users
|
|
14
|
-
Classifier: Development Status :: 3 - Alpha
|
|
15
|
-
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
|
-
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
27
|
-
Classifier: Programming Language :: C
|
|
28
|
-
Classifier: Programming Language :: C++
|
|
29
|
-
Classifier: Programming Language :: Cython
|
|
30
|
-
Classifier: Topic :: Software Development :: Code Generators
|
|
31
|
-
Classifier: Topic :: Software Development :: Compilers
|
|
32
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
|
-
Classifier: Typing :: Typed
|
|
34
|
-
Requires-Python: >=3.9
|
|
35
|
-
Description-Content-Type: text/x-rst
|
|
36
|
-
Dynamic: author
|
|
37
|
-
Dynamic: author-email
|
|
38
|
-
Dynamic: classifier
|
|
39
|
-
Dynamic: description
|
|
40
|
-
Dynamic: description-content-type
|
|
41
|
-
Dynamic: home-page
|
|
42
|
-
Dynamic: license
|
|
43
|
-
Dynamic: project-url
|
|
44
|
-
Dynamic: requires-python
|
|
45
|
-
Dynamic: summary
|
|
46
|
-
|
|
47
|
-
The Cython language makes writing C extensions for the Python language as
|
|
48
|
-
easy as Python itself. Cython is a source code translator based on Pyrex_,
|
|
49
|
-
but supports more cutting edge functionality and optimizations.
|
|
50
|
-
|
|
51
|
-
The Cython language is a superset of the Python language (almost all Python
|
|
52
|
-
code is also valid Cython code), but Cython additionally supports optional
|
|
53
|
-
static typing to natively call C functions, operate with C++ classes and
|
|
54
|
-
declare fast C types on variables and class attributes. This allows the
|
|
55
|
-
compiler to generate very efficient C code from Cython code.
|
|
56
|
-
|
|
57
|
-
This makes Cython the ideal language for writing glue code for external
|
|
58
|
-
C/C++ libraries, and for fast C modules that speed up the execution of
|
|
59
|
-
Python code.
|
|
60
|
-
|
|
61
|
-
The newest Cython release can always be downloaded from https://cython.org/.
|
|
62
|
-
Unpack the tarball or zip file, enter the directory, and then run::
|
|
63
|
-
|
|
64
|
-
pip install .
|
|
65
|
-
|
|
66
|
-
Note that for one-time builds, e.g. for CI/testing, on platforms that are not
|
|
67
|
-
covered by one of the wheel packages provided on PyPI *and* the pure Python wheel
|
|
68
|
-
that we provide is not used, it is substantially faster than a full source build
|
|
69
|
-
to install an uncompiled (slower) version of Cython with::
|
|
70
|
-
|
|
71
|
-
NO_CYTHON_COMPILE=true pip install .
|
|
72
|
-
|
|
73
|
-
.. _Pyrex: https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
|
|
74
|
-
|
|
75
|
-
3.3.0a1 (2026-06-24)
|
|
76
|
-
====================
|
|
77
|
-
|
|
78
|
-
Features added
|
|
79
|
-
--------------
|
|
80
|
-
|
|
81
|
-
* Changes were made to adapt to Python 3.15 and its Limited API.
|
|
82
|
-
(Github issues https://github.com/cython/cython/issues/6405, https://github.com/cython/cython/issues/7190, https://github.com/cython/cython/issues/7347, https://github.com/cython/cython/issues/7348, https://github.com/cython/cython/issues/7358)
|
|
83
|
-
|
|
84
|
-
* PEP-634 Pattern Matching is implemented.
|
|
85
|
-
(Github issue https://github.com/cython/cython/issues/4029)
|
|
86
|
-
|
|
87
|
-
* Declared container item types (e.g. ``list[float]``) are now used by the type system.
|
|
88
|
-
(Github issue https://github.com/cython/cython/issues/7288)
|
|
89
|
-
|
|
90
|
-
* Type inference was improved for builtin Python types.
|
|
91
|
-
(Github issues https://github.com/cython/cython/issues/7536, https://github.com/cython/cython/issues/7644)
|
|
92
|
-
|
|
93
|
-
* Extension types can declare themselves explicitly as sequence or mapping with
|
|
94
|
-
``@cython.collection_type("sequence")`` or ``@cython.collection_type("mapping")``.
|
|
95
|
-
This has an effect on their behaviour in pattern matching and subscripting.
|
|
96
|
-
(Github issue https://github.com/cython/cython/issues/5027)
|
|
97
|
-
|
|
98
|
-
* Sequence types that have their ``Py_TPFLAGS_SEQUENCE`` type flag set can benefit from
|
|
99
|
-
faster subscripting via the sequence protocol as Cython now bypasses the mapping protocol
|
|
100
|
-
for them if both protocols are implemented.
|
|
101
|
-
(Github issue https://github.com/cython/cython/issues/7432)
|
|
102
|
-
|
|
103
|
-
* Sequence types marked as ``@cython.collection_type("sequence")`` that use C integers
|
|
104
|
-
in the subscript special methods now implement only the sequence and not the mapping protocol.
|
|
105
|
-
This allows subscripting code to avoid creating Python index objects when the index
|
|
106
|
-
is already available as C integer.
|
|
107
|
-
(Github issue https://github.com/cython/cython/issues/7435)
|
|
108
|
-
|
|
109
|
-
* The Py3.15 ``frozendict`` builtin type is supported and has been backported as an alias
|
|
110
|
-
for ``dict`` in older Python versions.
|
|
111
|
-
Patches to adapt existing ``dict`` optimisations were contributed by Omkar Kabde.
|
|
112
|
-
(Github issues https://github.com/cython/cython/issues/7545, https://github.com/cython/cython/issues/7647)
|
|
113
|
-
|
|
114
|
-
* The Py3.15 ``sentinel`` builtin is supported and its C-API declarations are available in
|
|
115
|
-
``cpython.sentinel``.
|
|
116
|
-
|
|
117
|
-
* The builtin Python types ``int``, ``float``, ``str``, ``bytes`` and ``bytearray``
|
|
118
|
-
are special cased in comparisons to speed them up.
|
|
119
|
-
(Github issues https://github.com/cython/cython/issues/7452, https://github.com/cython/cython/issues/7474)
|
|
120
|
-
|
|
121
|
-
* The builtin Python types ``int`` and ``float`` are special cased in ``+``, ``-`` and ``*``
|
|
122
|
-
operations with (compile-time) unknown Python types in order to speed them up.
|
|
123
|
-
The bit operations ``^``, ``|`` and ``&`` are additionally special cased for ``int``.
|
|
124
|
-
(Github issues https://github.com/cython/cython/issues/7485, https://github.com/cython/cython/issues/7541)
|
|
125
|
-
|
|
126
|
-
* ``<bool>`` casts can be used to convert C values to Python ``True`` / ``False``.
|
|
127
|
-
(Github issue https://github.com/cython/cython/issues/7513)
|
|
128
|
-
|
|
129
|
-
* ``cdef`` property methods support setters.
|
|
130
|
-
(Github issue https://github.com/cython/cython/issues/7505)
|
|
131
|
-
|
|
132
|
-
* The C ``restrict`` modifier can be used in declarations.
|
|
133
|
-
(Github issue https://github.com/cython/cython/issues/7617)
|
|
134
|
-
|
|
135
|
-
* C arrays may now be declared with (``extern`` or internal) enum values as their size.
|
|
136
|
-
(Github issues https://github.com/cython/cython/issues/7401, https://github.com/cython/cython/issues/7406)
|
|
137
|
-
|
|
138
|
-
* ``prange(num_threads=0)`` automatically selects the maximum number of OpenMP threads.
|
|
139
|
-
(Github issue https://github.com/cython/cython/issues/7586)
|
|
140
|
-
|
|
141
|
-
* ``prange()`` and ``parallel()`` sections can be used without releasing the GIL, which
|
|
142
|
-
helps in freethreading builds. When releasing the GIL as part of the section declaration,
|
|
143
|
-
re-acquiring it immediately inside is now faster, e.g. to do per-thread Python initialisations.
|
|
144
|
-
(Github issue https://github.com/cython/cython/issues/6562)
|
|
145
|
-
|
|
146
|
-
* ``cython.pymutex`` and ``cython.pythread_type_lock`` now support a ``.locked()`` method
|
|
147
|
-
to check if the lock is currently held without blocking. The method works on all Python
|
|
148
|
-
versions using atomic reads on Python 3.13+ and a try-acquire approach on older versions.
|
|
149
|
-
(Github issue https://github.com/cython/cython/issues/7275)
|
|
150
|
-
|
|
151
|
-
* A simpler mechanism was added for implementing C++ exception handlers in Cython code.
|
|
152
|
-
(Github issues https://github.com/cython/cython/issues/7388, https://github.com/cython/cython/issues/7390)
|
|
153
|
-
|
|
154
|
-
* Repeated memoryview slicing inside of loops now avoids redundant reference counting,
|
|
155
|
-
making it substantially faster.
|
|
156
|
-
(Github issue https://github.com/cython/cython/issues/5507)
|
|
157
|
-
|
|
158
|
-
* Indexing into Cython memoryview objects from Python is faster.
|
|
159
|
-
(Github issue https://github.com/cython/cython/issues/7529)
|
|
160
|
-
|
|
161
|
-
* Some internal call overhead in the memoryview code was removed.
|
|
162
|
-
(Github issue https://github.com/cython/cython/issues/7609)
|
|
163
|
-
|
|
164
|
-
* Extension types use the vectorcall interface for their instantiation in many cases.
|
|
165
|
-
This can be configured with a new C feature macro ``CYTHON_VECTORCALL_TPNEW``.
|
|
166
|
-
(Github issue https://github.com/cython/cython/issues/7698)
|
|
167
|
-
|
|
168
|
-
* Coroutine methods use the faster vectorcall interface.
|
|
169
|
-
(Github issue https://github.com/cython/cython/issues/7678)
|
|
170
|
-
|
|
171
|
-
* Vectorcalls with literal keyword arguments use cached constant keyword name tuples.
|
|
172
|
-
(Github issue https://github.com/cython/cython/issues/7713)
|
|
173
|
-
|
|
174
|
-
* List comprehensions that generate new objects avoid refcounting overhead for appending.
|
|
175
|
-
(Github issue https://github.com/cython/cython/issues/7748)
|
|
176
|
-
|
|
177
|
-
* Method calls in older Limited API versions are slightly faster.
|
|
178
|
-
(Github issue https://github.com/cython/cython/issues/7707)
|
|
179
|
-
|
|
180
|
-
* C arrays are substituted for sequence iteration in more cases, also inside of generators.
|
|
181
|
-
Ad-hoc C array storage on the stack and in closures was reworked along the way.
|
|
182
|
-
(Github issues https://github.com/cython/cython/issues/7323, https://github.com/cython/cython/issues/7339)
|
|
183
|
-
|
|
184
|
-
* Unicode string comparisons to single character literals are faster.
|
|
185
|
-
(Github issue https://github.com/cython/cython/issues/7418)
|
|
186
|
-
|
|
187
|
-
* F-strings are a little faster in some cases.
|
|
188
|
-
(Github issues https://github.com/cython/cython/issues/7495, https://github.com/cython/cython/issues/7526)
|
|
189
|
-
|
|
190
|
-
* PyPy and GraalPython use the vectorcall protocol to enable faster Python calls in future releases.
|
|
191
|
-
(Github issue https://github.com/cython/cython/issues/7614)
|
|
192
|
-
|
|
193
|
-
* The runtime conversion from a Python mapping to a C struct/union uses less code.
|
|
194
|
-
(Github issue https://github.com/cython/cython/issues/7343)
|
|
195
|
-
|
|
196
|
-
* The error handling of memoryviews uses less code.
|
|
197
|
-
(Github issue https://github.com/cython/cython/issues/7525)
|
|
198
|
-
|
|
199
|
-
* The runtime dispatch code of fused types uses less code.
|
|
200
|
-
(Github issue https://github.com/cython/cython/issues/7501)
|
|
201
|
-
|
|
202
|
-
* More code is extracted to the shared utility code module.
|
|
203
|
-
(Github issues https://github.com/cython/cython/issues/7556, https://github.com/cython/cython/issues/7570)
|
|
204
|
-
|
|
205
|
-
* Cython compiled functions have a more efficient memory layout in the Limited API.
|
|
206
|
-
(Github issue https://github.com/cython/cython/issues/7519)
|
|
207
|
-
|
|
208
|
-
* Module string content is now compressed with LZSS by default, which reduces the footprint of the
|
|
209
|
-
decompressor code compared to the 3.2.x default ``zlib``. This also avoids a runtime dependency
|
|
210
|
-
on the ``zlib`` module since the tiny LZSS decompressor can be embedded in the module.
|
|
211
|
-
(Github issue https://github.com/cython/cython/issues/7577)
|
|
212
|
-
|
|
213
|
-
* The Py2 ``print`` statement is now implemented in Cython instead of C to make it
|
|
214
|
-
thread-safe and uses a vectorcall into Python.
|
|
215
|
-
(Github issue https://github.com/cython/cython/issues/7642)
|
|
216
|
-
|
|
217
|
-
* Several C++ exception declarations were added to ``libcpp.exceptions``.
|
|
218
|
-
(Github issue https://github.com/cython/cython/issues/7389)
|
|
219
|
-
|
|
220
|
-
* Missing Python type flag declarations were added to ``cpython.object``.
|
|
221
|
-
(Github issue https://github.com/cython/cython/issues/7441)
|
|
222
|
-
|
|
223
|
-
* Declarations for ``PyType_GetSlot()`` and the corresponding type slot IDs were added
|
|
224
|
-
to ``cpython.type``.
|
|
225
|
-
|
|
226
|
-
* Declarations for specialised byte-conversion functions were added to ``cpython.long`` and ``cpython.float``.
|
|
227
|
-
Patch by Valentin Valls. (Github issue https://github.com/cython/cython/issues/7738)
|
|
228
|
-
|
|
229
|
-
* Error detection when assigning to ``const`` variables was improved.
|
|
230
|
-
(Github issue https://github.com/cython/cython/issues/7359)
|
|
231
|
-
|
|
232
|
-
* Some cases of likely misuse of ``critical_section`` now generate warnings.
|
|
233
|
-
(Github issue https://github.com/cython/cython/issues/6766)
|
|
234
|
-
|
|
235
|
-
* Programmatic use of Cython has become easier by avoiding the need to manually set up
|
|
236
|
-
the error reporting.
|
|
237
|
-
(Github issue https://github.com/cython/cython/issues/7235)
|
|
238
|
-
|
|
239
|
-
* Autoscaling in ``cymeit`` is a little faster.
|
|
240
|
-
|
|
241
|
-
* Unicode 17.0.0 is used to parse identifiers.
|
|
242
|
-
|
|
243
|
-
Bugs fixed
|
|
244
|
-
----------
|
|
245
|
-
|
|
246
|
-
* Generated Cython language features like properties, auto-pickle or dataclasses
|
|
247
|
-
now use a critical section (on the object itself) as guard for concurrent access.
|
|
248
|
-
(Github issue https://github.com/cython/cython/issues/6621)
|
|
249
|
-
|
|
250
|
-
* The star-import implementation needlessly rejected several names in internal use.
|
|
251
|
-
They are now allowed and become regular Python module attributes.
|
|
252
|
-
(Github issue https://github.com/cython/cython/issues/4931)
|
|
253
|
-
|
|
254
|
-
* Mixing function signature declarations in Python modules and their ``.pxd`` modules could fail.
|
|
255
|
-
(Github issues https://github.com/cython/cython/issues/5970, https://github.com/cython/cython/issues/4388)
|
|
256
|
-
|
|
257
|
-
* C array declarations with type and size could fail with an exception in pure Python code.
|
|
258
|
-
(Github issue https://github.com/cython/cython/issues/7372)
|
|
259
|
-
|
|
260
|
-
* A ``const`` modifier in C++ template type arguments could be mapped incorrectly.
|
|
261
|
-
(Github issue https://github.com/cython/cython/issues/6294)
|
|
262
|
-
|
|
263
|
-
* C++ ``typeid()`` failed to compile on more complex expressions.
|
|
264
|
-
(Github issue https://github.com/cython/cython/issues/7069)
|
|
265
|
-
|
|
266
|
-
* Optimised Python ``int`` and ``float`` operations did not remember their result type,
|
|
267
|
-
leading to less optimised code in longer expressions.
|
|
268
|
-
(Github issues https://github.com/cython/cython/issues/7363, https://github.com/cython/cython/issues/7502)
|
|
269
|
-
|
|
270
|
-
* Slices as dictionary keys confused the type inference of item access.
|
|
271
|
-
(Github issue https://github.com/cython/cython/issues/7702)
|
|
272
|
-
|
|
273
|
-
* A race condition when ``return``ing from a ``cython.parallel.parallel`` section was fixed.
|
|
274
|
-
(Github issue https://github.com/cython/cython/issues/6521)
|
|
275
|
-
|
|
276
|
-
* Cython still used ``(type, exc, traceback)`` for saving and restoring exception state,
|
|
277
|
-
even though modern CPython versions only store the exception object itself internally.
|
|
278
|
-
This is now modernised in many places to reduce overhead.
|
|
279
|
-
(Github issue https://github.com/cython/cython/issues/7481)
|
|
280
|
-
|
|
281
|
-
* Exceptions originating from the ``Py_UNICODE_IS*()`` character classification macros and
|
|
282
|
-
the corresponding ``str.is*()`` methods, which they alias, were not handled but ignored in
|
|
283
|
-
the Limited API.
|
|
284
|
-
(Github issue https://github.com/cython/cython/issues/7602)
|
|
285
|
-
|
|
286
|
-
* In the Limited API, import time failures to create code objects for compiled functions,
|
|
287
|
-
e.g. due to future Python API changes, are no longer fatal but generate a warning.
|
|
288
|
-
(Github issue https://github.com/cython/cython/issues/5718)
|
|
289
|
-
|
|
290
|
-
* Several internal cases where exceptions are caught and discarded now propagate the
|
|
291
|
-
``BaseException`` errors and only discard the expected exceptions.
|
|
292
|
-
(Github issue https://github.com/cython/cython/issues/7600)
|
|
293
|
-
|
|
294
|
-
* Error handling was improved when setting up the table of ``cdef`` methods for extension types
|
|
295
|
-
and unexpected errors are propagated.
|
|
296
|
-
(Github issue https://github.com/cython/cython/issues/7613)
|
|
297
|
-
|
|
298
|
-
* Exceptions while setting up the automatic pickle support are now propagated.
|
|
299
|
-
(Github issue https://github.com/cython/cython/issues/7613)
|
|
300
|
-
|
|
301
|
-
* Exceptions thrown into async generators could leave the generator in an unclosed state.
|
|
302
|
-
(Github issue https://github.com/cython/cython/issues/7618)
|
|
303
|
-
|
|
304
|
-
* In the Limited API, failures while formatting type names in exceptions are now uniformly handled.
|
|
305
|
-
(Github issue https://github.com/cython/cython/issues/7680)
|
|
306
|
-
|
|
307
|
-
* The global module state struct now lives in an anonymous namespace in C++ mode to
|
|
308
|
-
allow linking multiple modules together in one shared library file.
|
|
309
|
-
(Github issue https://github.com/cython/cython/issues/7159)
|
|
310
|
-
|
|
311
|
-
* Dict iteration generates safer code in PyPy/GraalPy/free-threading.
|
|
312
|
-
(Github issue https://github.com/cython/cython/issues/7637)
|
|
313
|
-
|
|
314
|
-
* The floating point parsing code relied on C implementation specific "pointer compare after free" behaviour.
|
|
315
|
-
Patch by stratakis. (Github issue https://github.com/cython/cython/issues/7463)
|
|
316
|
-
|
|
317
|
-
* When non-heap types were used as base classes of extension heap types, the heap types
|
|
318
|
-
were not correctly reference counted by their instances.
|
|
319
|
-
(Github issue https://github.com/cython/cython/issues/7483)
|
|
320
|
-
|
|
321
|
-
* The ``.__signatures__`` dict of fused functions is no longer writable.
|
|
322
|
-
(Github issue https://github.com/cython/cython/issues/7386)
|
|
323
|
-
|
|
324
|
-
* A minimal implementation of ``.__annotate__`` was added to Cython compiled functions to make
|
|
325
|
-
``@functools.wraps`` work in Python 3.14+.
|
|
326
|
-
(Github issue https://github.com/cython/cython/issues/7675)
|
|
327
|
-
|
|
328
|
-
* The ``--embed-positions`` option no longer includes absolute file paths in the C code.
|
|
329
|
-
(Github issue https://github.com/cython/cython/issues/6755)
|
|
330
|
-
|
|
331
|
-
* Error reporting on missing braces in f-strings was misleading.
|
|
332
|
-
(Github issue https://github.com/cython/cython/issues/7436)
|
|
333
|
-
|
|
334
|
-
* ``None`` default values for function arguments declared as ``not None`` are now rejected at compile time
|
|
335
|
-
rather than leading to errors at runtime.
|
|
336
|
-
Patch by Vyas Ramasubramani. (Github issue https://github.com/cython/cython/issues/7762)
|
|
337
|
-
|
|
338
|
-
* Cython did not reject code with multiple contradicting type annotations on the same variable.
|
|
339
|
-
(Github issue https://github.com/cython/cython/issues/7246)
|
|
340
|
-
|
|
341
|
-
* Cython no longer warns if ``@profile`` or ``@linetrace`` is applied to a function
|
|
342
|
-
without changing the global/outer setting. This avoids annoyance when users leave
|
|
343
|
-
such redundant decorators in the code for occasional use.
|
|
344
|
-
|
|
345
|
-
* Cached methods of builtin types were not GC-traversed and cleaned up as part of the module state.
|
|
346
|
-
Patch by Maxwell Bernstein. (Github issue https://github.com/cython/cython/issues/7468)
|
|
347
|
-
|
|
348
|
-
* Modules with non-ASCII names could end up with UTF-8 characters in their C code.
|
|
349
|
-
(Github issue https://github.com/cython/cython/issues/7588)
|
|
350
|
-
|
|
351
|
-
* Several C compiler warnings related to mixed signed/unsigned C integer usage were resolved.
|
|
352
|
-
|
|
353
|
-
* Includes all fixes as of Cython 3.2.6.
|
|
354
|
-
|
|
355
|
-
3.2.6 (2026-06-24):
|
|
356
|
-
|
|
357
|
-
* ``@functools.wraps()`` was broken in Py3.14+ for Cython compiled functions.
|
|
358
|
-
(Github issue https://github.com/cython/cython/issues/7675)
|
|
359
|
-
|
|
360
|
-
* A double-free in the t-string code was fixed.
|
|
361
|
-
(Github issue https://github.com/cython/cython/issues/7712)
|
|
362
|
-
|
|
363
|
-
* The ``-`` operator declarations for iterators in ``libcpp.vector`` we corrected.
|
|
364
|
-
Patch by Vadim Markovtsev. (Github issue https://github.com/cython/cython/issues/7717)
|
|
365
|
-
|
|
366
|
-
* The shared utility code module no longer uses a temporary file path that
|
|
367
|
-
changed the C code on each generation.
|
|
368
|
-
(Github issue https://github.com/cython/cython/issues/7723)
|
|
369
|
-
|
|
370
|
-
* On 32 bit platforms, cached constants are no longer made immortal during module import.
|
|
371
|
-
(Github issue https://github.com/cython/cython/issues/7744)
|
|
372
|
-
|
|
373
|
-
Other changes
|
|
374
|
-
-------------
|
|
375
|
-
|
|
376
|
-
* Support for Python 3.8 has been removed.
|
|
377
|
-
As a side-effekt, support for StacklessPython and Pyston (last release was 3.8) was also removed.
|
|
378
|
-
Python 3.9 is planned to remain supported for several years due to its use in LTS Linux distributions.
|
|
379
|
-
(Github issue https://github.com/cython/cython/issues/7271)
|
|
380
|
-
|
|
381
|
-
* The vectorcall feature macros were unified to make ``CYTHON_VECTORCALL`` the only way to
|
|
382
|
-
disable this feature (if need arises). Previously the option macros ``CYTHON_METH_FASTCALL``,
|
|
383
|
-
``CYTHON_FAST_PYCALL`` and ``CYTHON_VECTORCALL`` all controlled different aspects of the
|
|
384
|
-
implementation.
|
|
385
|
-
(Github issue https://github.com/cython/cython/issues/7616)
|
|
386
|
-
|
|
387
|
-
* Coroutines no longer provide the legacy ``_is_coroutine`` property.
|
|
388
|
-
(Github issue https://github.com/cython/cython/issues/7709)
|
|
389
|
-
|
|
390
|
-
* ``Cython/Shadow.pyi`` has been merged into ``Cython/Shadow.py``.
|
|
391
|
-
(Github issue https://github.com/cython/cython/issues/7376)
|
|
392
|
-
|
|
393
|
-
* The documentation now uses the "Clarity" Sphinx theme.
|
|
394
|
-
Patch by Libor Jelínek. (Github issue https://github.com/cython/cython/issues/7564)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|