Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.13 adds C macros/functions/types without the Py/_Py prefix #118771

Closed
12 of 28 tasks
encukou opened this issue May 8, 2024 · 4 comments
Closed
12 of 28 tasks

3.13 adds C macros/functions/types without the Py/_Py prefix #118771

encukou opened this issue May 8, 2024 · 4 comments

Comments

@encukou
Copy link
Member

encukou commented May 8, 2024

3.13 newly defines the following unprefixed functions/macros/types via Python.h. They should probably be hidden:

  • uop_get_target in Include/cpython/optimizer.h:67
  • uop_get_exit_index in Include/cpython/optimizer.h:73
  • uop_get_jump_target in Include/cpython/optimizer.h:79
  • uop_get_error_target in Include/cpython/optimizer.h:85
  • BLOOM_FILTER_WORDS in Include/cpython/optimizer.h
  • UOP_FORMAT_TARGET in Include/cpython/optimizer.h
  • UOP_FORMAT_EXIT in Include/cpython/optimizer.h
  • UOP_FORMAT_JUMP in Include/cpython/optimizer.h
  • UOP_FORMAT_UNUSED in Include/cpython/optimizer.h
  • struct _bloom_filter in Include/cpython/optimizer.h:19
  • struct _exit_data in Include/cpython/optimizer.h:91
  • optimize_func in Include/cpython/optimizer.h:112
  • CO_NO_MONITORING_EVENTS in Include/cpython/code.h:192

Some more are generated by configure:

  • HAVE_CLOCK_T in ./pyconfig.h:138
  • HAVE_CLOSEFROM in ./pyconfig.h:138
  • HAVE_GETGRENT in ./pyconfig.h:138
  • HAVE_GRANTPT in ./pyconfig.h:515
  • HAVE_POSIX_OPENPT in ./pyconfig.h:849
  • HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSEFROM_NP in ./pyconfig.h:849
  • HAVE_PROCESS_VM_READV in ./pyconfig.h:849
  • HAVE_PTSNAME in ./pyconfig.h:957
  • HAVE_PTSNAME_R in ./pyconfig.h:957
  • HAVE_SOCKLEN_T in ./pyconfig.h:957
  • HAVE_SYS_TIMERFD_H in ./pyconfig.h:1406
  • HAVE_TIMERFD_CREATE in ./pyconfig.h:1406
  • HAVE_UNLOCKPT in ./pyconfig.h:1406
  • HAVE___UINT128_T in ./pyconfig.h:1582
  • WITH_MIMALLOC in ./pyconfig.h:1867

Linked PRs

@encukou encukou changed the title 3.13 adds C macros & functions without the Py/_Py prefix 3.13 adds C macros/functions/types without the Py/_Py prefix May 9, 2024
@vstinner
Copy link
Member

Can't we move most of Include/cpython/optimizer.h contents to the internal C API? Is there a reason to expose it? I mean, the private functions (named prefixed by _Py).

@vstinner
Copy link
Member

Can't we move most of Include/cpython/optimizer.h contents to the internal C API?

Done in commit e26e098:

commit e26e0985d94f1b9812cf41f043df89185f247945
Author: Victor Stinner <[email protected]>
Date:   Wed Jun 26 15:35:19 2024 +0200

    [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043)
    
    gh-120642: Move private PyCode APIs to the internal C API (#120643)
    
    * Move _Py_CODEUNIT and related functions to pycore_code.h.
    * Move _Py_BackoffCounter to pycore_backoff.h.
    * Move Include/cpython/optimizer.h content to pycore_optimizer.h.
    * Remove Include/cpython/optimizer.h.
    * Remove PyUnstable_Replace_Executor().
    
    Rename functions:
    
    * PyUnstable_GetExecutor() => _Py_GetExecutor()
    * PyUnstable_GetOptimizer() => _Py_GetOptimizer()
    * PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer()
    * PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter()
    * PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer()
    
    (cherry picked from commit 9e4a81f00fef689c6e18a64245aa064eaadc7ac7)

@vstinner
Copy link
Member

@encukou: Python 3.13.0 was released last October, it's now too late to change remaining functions/types. Can we close this issue?

@encukou
Copy link
Member Author

encukou commented Jan 28, 2025

Sure, I merged the rest into #118915.

@encukou encukou closed this as completed Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants