pitrou commented on code in PR #37097:
URL: https://github.com/apache/arrow/pull/37097#discussion_r1296196774


##########
python/pyarrow/_dataset_parquet.pyx:
##########
@@ -741,7 +737,15 @@ cdef class ParquetFragmentScanOptions(FragmentScanOptions):
             thrift_string_size_limit=self.thrift_string_size_limit,
             thrift_container_size_limit=self.thrift_container_size_limit,
         )
-        return type(self)._reconstruct, (kwargs,)
+        return _reconstruct_parquet_fragment_scan_options, (kwargs,)
+
+
+def _reconstruct_parquet_fragment_scan_options(kwargs):
+    # __reduce__ doesn't allow passing named arguments directly to the
+    # reconstructor, hence this wrapper.
+    # In Cython >= 3.0.0, function binding is turned on by default, so
+    # a global static method is used (instead of a class method) for pickling.

Review Comment:
   Which docs? Cython docs?
   
   It works fine in pure Python, but it may be a Cython wart, in which case it 
would be nice to report an issue:
   ```python
   >>> class C:
   ...:     @staticmethod
   ...:     def sm(): pass
   ...: 
   >>> pickle.dumps(C.sm)
   
b'\x80\x04\x95\x15\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x04C.sm\x94\x93\x94.'
   >>> pickle.loads(pickle.dumps(C.sm))
   <function __main__.C.sm()>
   >>> pickle.loads(pickle.dumps(C().sm))
   <function __main__.C.sm()>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to