You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// the global int_cache is shared among all instances
401
-
402
-
// static PyObject *int_cache = NULL;
403
-
404
-
// // NOTE: this used to be a Py_ssize_t, which can be 32 bits on some machines and might easily overflow with a few very large indices. Using an explicit 64-bit int seems safer
405
-
// static npy_int64 key_count_global = 0;
406
-
407
-
// // Fill the int_cache up to size_needed with PyObject ints; `size` is not the key_count_global.
408
-
// static int
409
-
// int_cache_fill(Py_ssize_t size_needed)
410
-
// {
411
-
// PyObject *item;
412
-
// if (!int_cache) {
413
-
// int_cache = PyList_New(0);
414
-
// if (!int_cache) {
415
-
// return -1;
416
-
// }
417
-
// }
418
-
// for (Py_ssize_t i = PyList_GET_SIZE(int_cache); i < size_needed; i++) {
419
-
// item = PyLong_FromSsize_t(i);
420
-
// if (!item) {
421
-
// return -1;
422
-
// }
423
-
// if (PyList_Append(int_cache, item)) {
424
-
// Py_DECREF(item);
425
-
// return -1;
426
-
// }
427
-
// Py_DECREF(item);
428
-
// }
429
-
// return 0;
430
-
// }
431
-
432
-
// // Given the current key_count_global, remove cache elements only if the key_count is less than the the current size of the int_cache.
433
-
// void
434
-
// int_cache_remove(Py_ssize_t key_count)
435
-
// {
436
-
// if (!key_count) {
437
-
// Py_CLEAR(int_cache);
438
-
// }
439
-
// else if (key_count < PyList_GET_SIZE(int_cache)) {
// For a FAMI, Return appropriate PyObject for items, keys, and values. When values are needed they are retrieved from the int_cache. For consistency with NumPy array iteration, arrays use PyArray_ToScalar instead of PyArray_GETITEM.
425
+
// For a FAMI, Return appropriate PyObject for items, keys, and values. For consistency with NumPy array iteration, arrays use PyArray_ToScalar instead of PyArray_GETITEM.
472
426
staticPyObject*
473
427
fami_iternext(FAMIObject*self)
474
428
{
@@ -1556,10 +1510,6 @@ insert_string(
1556
1510
staticint
1557
1511
grow_table(FAMObject*self, Py_ssize_tkeys_size)
1558
1512
{
1559
-
// NOTE: this is the only place int_cache_fill is called; it is not called with key_count_global, but with the max value needed
PyErr_SetString(PyExc_NotImplementedError, "Not supported for array keys");
1724
1671
return-1;
1725
1672
}
1726
-
// key_count_global++;
1727
1673
self->keys_size++;
1728
1674
1729
1675
if (grow_table(self, self->keys_size)) {
@@ -1746,7 +1692,7 @@ fam_length(FAMObject *self)
1746
1692
}
1747
1693
1748
1694
1749
-
// Given a key for a FAM, return the Python integer (via the int_cache) associated with that key. Utility function used in both fam_subscript() and fam_get()
1695
+
// Given a key for a FAM, return the Python integer associated with that key. Utility function used in both fam_subscript() and fam_get()
0 commit comments