Expose _PyGC_generation0 for allowing internal use directly from a CPython extension

Hi I would like to be able to get an handle on PyGC_Head*_PyGC_generation0 from a CPython extension. This is possible when building Python on a Posix host, but not on Windows because of a missing PyAPI_DATA wrapping of the said object in the objimpl.h header. Having the possibility to inspect the PyGC_Head here can be very useful when customizing the way a garbage-collectable object created from CPython extension would be cleaned/inspected, etc. Any chance this patch could be added to get the same capabilities on Windows and Posix platforms ? Thanks for your feedback, Eloi Index: Include/objimpl.h =================================================================== --- Include/objimpl.h (revision 118072) +++ Include/objimpl.h (working copy) @@ -258,7 +258,7 @@ double dummy; /* force worst-case alignment */ } PyGC_Head; -extern PyGC_Head *_PyGC_generation0; +PyAPI_DATA(PyGC_Head*) _PyGC_generation0; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)

This looks like an issue for bugs.python.org. After opening a bug there you could also try to fix this yourself and submit a Pull Request (see the Python devguide). On Fri, Oct 18, 2019 at 3:10 AM GAUDRY Eloi <eloi.gaudry@fft.be> wrote:
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>

ok, I will. thanks éloi ________________________________ From: Guido van Rossum <guido@python.org> Sent: Friday, October 18, 2019 20:26 To: GAUDRY Eloi <Eloi.Gaudry@hexagon.com> Cc: python-ideas@python.org <python-ideas@python.org> Subject: Re: [Python-ideas] Expose _PyGC_generation0 for allowing internal use directly from a CPython extension This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email. This looks like an issue for bugs.python.org<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbugs.python.org&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104418592&sdata=Z%2BpjTZjKMUe65YQ00orbqLnCm%2FUj5B3aEoM5kaAQnG4%3D&reserved=0>. After opening a bug there you could also try to fix this yourself and submit a Pull Request (see the Python devguide). On Fri, Oct 18, 2019 at 3:10 AM GAUDRY Eloi <eloi.gaudry@fft.be<mailto:eloi.gaudry@fft.be>> wrote: Hi I would like to be able to get an handle on PyGC_Head*_PyGC_generation0 from a CPython extension. This is possible when building Python on a Posix host, but not on Windows because of a missing PyAPI_DATA wrapping of the said object in the objimpl.h header. Having the possibility to inspect the PyGC_Head here can be very useful when customizing the way a garbage-collectable object created from CPython extension would be cleaned/inspected, etc. Any chance this patch could be added to get the same capabilities on Windows and Posix platforms ? Thanks for your feedback, Eloi Index: Include/objimpl.h =================================================================== --- Include/objimpl.h (revision 118072) +++ Include/objimpl.h (working copy) @@ -258,7 +258,7 @@ double dummy; /* force worst-case alignment */ } PyGC_Head; -extern PyGC_Head *_PyGC_generation0; +PyAPI_DATA(PyGC_Head*) _PyGC_generation0; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) _______________________________________________ Python-ideas mailing list -- python-ideas@python.org<mailto:python-ideas@python.org> To unsubscribe send an email to python-ideas-leave@python.org<mailto:python-ideas-leave@python.org> https://mail.python.org/mailman3/lists/python-ideas.python.org/<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman3%2Flists%2Fpython-ideas.python.org%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104418592&sdata=9KU0d%2FXVeKzlKB1zUqnaYyUuslD1E42WkF6goYI8SKo%3D&reserved=0> Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7FC2NHAOMKBHONFTUKMAHO5F56UU5UUD/<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Farchives%2Flist%2Fpython-ideas%40python.org%2Fmessage%2F7FC2NHAOMKBHONFTUKMAHO5F56UU5UUD%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=TLatITHs8aQXsaI5571dwT0Dm1H2yPyj59n6YwsW1Ww%3D&reserved=0> Code of Conduct: http://python.org/psf/codeofconduct/<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=myMThkARwNLUC2JDY%2BFfjRBelx0pAw0RgFupbBKVGTE%3D&reserved=0> -- --Guido van Rossum (python.org/~guido<https://eur02.safelinks.protection.outlook.com/?url=http:%2F%2Fpython.org%2F~guido&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=qAr2KltzGmN9leqXjod6HClUHGhiCCad5VI2baCYA2Y%3D&reserved=0>) Pronouns: he/him (why is my pronoun here?)<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffeministing.com%2F2015%2F02%2F03%2Fhow-using-they-as-a-singular-pronoun-can-change-the-world%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104438578&sdata=TllieS8Ws7kbh1Ts3iS1smsroY3TNna%2BGvZ%2FGWPqvRk%3D&reserved=0>

He opened https://bugs.python.org/issue38542 It seems like the issue is specific to Python 2.7. Well, see the issue for more details ;-) Victor

This looks like an issue for bugs.python.org. After opening a bug there you could also try to fix this yourself and submit a Pull Request (see the Python devguide). On Fri, Oct 18, 2019 at 3:10 AM GAUDRY Eloi <eloi.gaudry@fft.be> wrote:
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>

ok, I will. thanks éloi ________________________________ From: Guido van Rossum <guido@python.org> Sent: Friday, October 18, 2019 20:26 To: GAUDRY Eloi <Eloi.Gaudry@hexagon.com> Cc: python-ideas@python.org <python-ideas@python.org> Subject: Re: [Python-ideas] Expose _PyGC_generation0 for allowing internal use directly from a CPython extension This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email. This looks like an issue for bugs.python.org<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbugs.python.org&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104418592&sdata=Z%2BpjTZjKMUe65YQ00orbqLnCm%2FUj5B3aEoM5kaAQnG4%3D&reserved=0>. After opening a bug there you could also try to fix this yourself and submit a Pull Request (see the Python devguide). On Fri, Oct 18, 2019 at 3:10 AM GAUDRY Eloi <eloi.gaudry@fft.be<mailto:eloi.gaudry@fft.be>> wrote: Hi I would like to be able to get an handle on PyGC_Head*_PyGC_generation0 from a CPython extension. This is possible when building Python on a Posix host, but not on Windows because of a missing PyAPI_DATA wrapping of the said object in the objimpl.h header. Having the possibility to inspect the PyGC_Head here can be very useful when customizing the way a garbage-collectable object created from CPython extension would be cleaned/inspected, etc. Any chance this patch could be added to get the same capabilities on Windows and Posix platforms ? Thanks for your feedback, Eloi Index: Include/objimpl.h =================================================================== --- Include/objimpl.h (revision 118072) +++ Include/objimpl.h (working copy) @@ -258,7 +258,7 @@ double dummy; /* force worst-case alignment */ } PyGC_Head; -extern PyGC_Head *_PyGC_generation0; +PyAPI_DATA(PyGC_Head*) _PyGC_generation0; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) _______________________________________________ Python-ideas mailing list -- python-ideas@python.org<mailto:python-ideas@python.org> To unsubscribe send an email to python-ideas-leave@python.org<mailto:python-ideas-leave@python.org> https://mail.python.org/mailman3/lists/python-ideas.python.org/<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman3%2Flists%2Fpython-ideas.python.org%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104418592&sdata=9KU0d%2FXVeKzlKB1zUqnaYyUuslD1E42WkF6goYI8SKo%3D&reserved=0> Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7FC2NHAOMKBHONFTUKMAHO5F56UU5UUD/<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Farchives%2Flist%2Fpython-ideas%40python.org%2Fmessage%2F7FC2NHAOMKBHONFTUKMAHO5F56UU5UUD%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=TLatITHs8aQXsaI5571dwT0Dm1H2yPyj59n6YwsW1Ww%3D&reserved=0> Code of Conduct: http://python.org/psf/codeofconduct/<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=myMThkARwNLUC2JDY%2BFfjRBelx0pAw0RgFupbBKVGTE%3D&reserved=0> -- --Guido van Rossum (python.org/~guido<https://eur02.safelinks.protection.outlook.com/?url=http:%2F%2Fpython.org%2F~guido&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104428584&sdata=qAr2KltzGmN9leqXjod6HClUHGhiCCad5VI2baCYA2Y%3D&reserved=0>) Pronouns: he/him (why is my pronoun here?)<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffeministing.com%2F2015%2F02%2F03%2Fhow-using-they-as-a-singular-pronoun-can-change-the-world%2F&data=02%7C01%7C%7C4bebd5ea46844dd5212008d753f8bd2c%7C1b16ab3eb8f64fe39f3e2db7fe549f6a%7C0%7C0%7C637070200104438578&sdata=TllieS8Ws7kbh1Ts3iS1smsroY3TNna%2BGvZ%2FGWPqvRk%3D&reserved=0>

He opened https://bugs.python.org/issue38542 It seems like the issue is specific to Python 2.7. Well, see the issue for more details ;-) Victor
participants (4)
-
Andrew Svetlov
-
GAUDRY Eloi
-
Guido van Rossum
-
Victor Stinner