[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 74b662cf202753d224d82d5503974cce881f7436 by Victor Stinner 
(Joannah Nanjekye) in branch 'master':
bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)
https://github.com/python/cpython/commit/74b662cf202753d224d82d5503974cce881f7436


--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

The function is not documented nor tested.

I searched for usage of PyGen_NeedsFinalizing() in C code in GitHub:
https://github.com/search?l=C=1=PyGen_NeedsFinalizing=Code

I only found copies of the CPython code source: PyGen_NeedsFinalizing() 
definition in genobject.h.

IHMO we can safely remove the function right now. If someone complains, we can 
reintroduce it later. We just have to document clearly its removal at:
https://docs.python.org/dev/whatsnew/3.9.html#build-and-c-api-changes

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

PyGen_NeedsFinalizing() was added by:

commit 49fd7fa4431da299196d74087df4a04f99f9c46f
Author: Thomas Wouters 
Date:   Fri Apr 21 10:40:58 2006 +

Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html

Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:

test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec

This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.

It was used in this gcmodule.c function:

/* Return true if object has a finalization method.
 * CAUTION:  An instance of an old-style class has to be checked for a
 *__del__ method, and earlier versions of this used to call PyObject_HasAttr,
 * which in turn could call the class's __getattr__ hook (if any).  That
 * could invoke arbitrary Python code, mutating the object graph in arbitrary
 * ways, and that was the source of some excruciatingly subtle bugs.
 */
static int
has_finalizer(PyObject *op)
{
if (PyInstance_Check(op)) {
assert(delstr != NULL);
return _PyInstance_Lookup(op, delstr) != NULL;
}
else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
return op->ob_type->tp_del != NULL;
else if (PyGen_CheckExact(op))
return PyGen_NeedsFinalizing((PyGenObject *)op);
else
return 0;
}


(2) The PEP 442 implementation made PyGen_NeedsFinalizing() useless:

commit 796564c27b8f2e32b9fbc034bbdda75f9507ca43
Author: Antoine Pitrou 
Date:   Tue Jul 30 19:59:21 2013 +0200

Issue #18112: PEP 442 implementation (safe object finalization).

Replaced:

/* Return true if object has a finalization method. */
static int
has_finalizer(PyObject *op)
{
if (PyGen_CheckExact(op))
return PyGen_NeedsFinalizing((PyGenObject *)op);
else
return op->ob_type->tp_del != NULL;
}

with:

/* Return true if object has a pre-PEP 442 finalization method. */
static int
has_legacy_finalizer(PyObject *op)
{
return op->ob_type->tp_del != NULL;
}

--

The last reference to PyGen_NeedsFinalizing() can be found in ceval.c:

case TARGET(SETUP_FINALLY): {
/* NOTE: If you add any new block-setup opcodes that
   are not try/except/finally handlers, you may need
   to update the PyGen_NeedsFinalizing() function.
   */

PyFrame_BlockSetup(f, SETUP_FINALLY, INSTR_OFFSET() + oparg,
   STACK_LEVEL());
DISPATCH();
}

--
nosy: +vstinner

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

My searches show references to this function in CPython cloned repositories. 
From @pitrous's views, I think it is better to deprecate it with a removal 
notice for a later release.

I have deprecated the Function instead and will be removed in the next release 
in this PR https://github.com/python/cpython/pull/15702 .

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +15356
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15702

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-03 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks again, Antoine.  I'll see what I can come up with.  :-)

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think https://searchcode.com/ may have a larger indexing base than GitHub 
alone.

And, yes, you'll see many duplicates of the CPython source code... Visual 
inspection may be needed :-/

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-02 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks Antoine.

Do you have a good way for searching third party projects?  I searched on 
Github and I'm getting a lot of references to the CPython filenames.  I don't 
know how to check if anyone is making calls to the function.  But, maybe that's 
the point and it can't be removed if there's a chance that anyone uses it?  
Thanks!

This is what I tried on Github:
PyGen_NeedsFinalizing -filename:ceval -filename:genobject -filename:gcmodule

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Cheryl: it may be useful to do a code search to find out whether any 
third-party projects are relying on PyGen_NeedsFinalizing.

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-03-25 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

What should be done for the PyGen_NeedsFinalizing API?  Does it need to be 
documented or should it be removed since it's no longer used in the code base?

Thanks!

--
nosy: +csabella
versions: +Python 3.7, Python 3.8 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2014-04-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

For the record, PyGen_NeedsFinalizing still exists but it isn't used anymore in 
the code base (following PEP 442).

--
nosy: +pitrou

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2013-04-30 Thread Nathan Housel

Nathan Housel added the comment:

Please correct me if I'm wrong, but I think PyGen_NeedsFinalizing should not be 
an API function because it is only used, nor _PyGen_FetchStopIterationValue. In 
the attached patch I've removed PyGen_NeedsFinalizing and 
_PyGen_FetchStopIterationValue fom the public API.

--
keywords: +patch
nosy: +plasticgap
Added file: http://bugs.python.org/file30079/Issue15088.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15088
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2012-06-16 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

Currently undocumented: http://docs.python.org/py3k/c-api/gen.html
Public API in a released version of Python: 
http://hg.python.org/cpython/file/3.2/Include/genobject.h

--
messages: 163012
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: PyGen_NeedsFinalizing is public, but undocumented

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15088
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2012-06-16 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
versions: +Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15088
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com