[issue35438] Cleanup extension functions using _PyObject_LookupSpecial

2018-12-10 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Agreed with everything in Serhiy's comments. This patch disregards why 
_PyObject_LookupSpecial and the various _Py_IDENTIFIER related stuff was 
created in the first place (to handle a non-trivial task efficiently/correctly) 
in favor of trying to avoid C-APIs that are explicitly okay to use for the 
CPython standard extensions. The goal is a mistake in the first place; no patch 
fix will make the goal correct.

Closing as not a bug.

--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35438] Cleanup extension functions using _PyObject_LookupSpecial

2018-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is nothing wrong with using private C API in the implementation of 
standard CPython extensions. This API was designed for this.

In contrary, there are problems with your code:

* It is less efficient. String objects are created and destroyed twice per 
every function call, in PyObject_HasAttrString() and in PyObject_CallMethod(). 
Format string is parsed in PyObject_CallMethod(). Other temporary objects are 
created and destroyed.

* It uses inherently broken PyObject_HasAttrString(). PyObject_HasAttrString() 
swallows exceptions (for example a MemoryError raised when create a temporary 
string object) and can return an incorrect result.

* It is not equivalent with the existing code. For example it does not work 
properly if the dunder method is a static method.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35438] Cleanup extension functions using _PyObject_LookupSpecial

2018-12-10 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

I also fixed the title to properly reflect what this is trying to achieve.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35438] Cleanup extension functions using _PyObject_LookupSpecial

2018-12-10 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
title: Extension modules using non-API functions -> Cleanup extension functions 
using _PyObject_LookupSpecial

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com