Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-45434: Mark the PyTokenizer C API as private#28924

Merged
vstinner merged 1 commit intopython:mainpython/cpython:mainfrom
vstinner:private_tokenizeCopy head branch name to clipboard
Oct 13, 2021
Merged

bpo-45434: Mark the PyTokenizer C API as private#28924
vstinner merged 1 commit intopython:mainpython/cpython:mainfrom
vstinner:private_tokenizeCopy head branch name to clipboard

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Oct 13, 2021

Rename PyTokenize functions to mark them as private:

  • PyTokenizer_FindEncodingFilename() => _PyTokenizer_FindEncodingFilename()
  • PyTokenizer_FromString() => _PyTokenizer_FromString()
  • PyTokenizer_FromFile() => _PyTokenizer_FromFile()
  • PyTokenizer_FromUTF8() => _PyTokenizer_FromUTF8()
  • PyTokenizer_Free() => _PyTokenizer_Free()
  • PyTokenizer_Get() => _PyTokenizer_Get()

Remove the unused PyTokenizer_FindEncoding() function.

import.c: remove unused #include "errcode.h".

https://bugs.python.org/issue45434

Rename PyTokenize functions to mark them as private:

* PyTokenizer_FindEncodingFilename() => _PyTokenizer_FindEncodingFilename()
* PyTokenizer_FromString() => _PyTokenizer_FromString()
* PyTokenizer_FromFile() => _PyTokenizer_FromFile()
* PyTokenizer_FromUTF8() => _PyTokenizer_FromUTF8()
* PyTokenizer_Free() => _PyTokenizer_Free()
* PyTokenizer_Get() => _PyTokenizer_Get()

Remove the unused PyTokenizer_FindEncoding() function.

import.c: remove unused #include "errcode.h".
@vstinner
Copy link
Member Author

@pablogsal @isidentical @lysnikolaou: Do you see any reason to keep the PyTokenizer as public?

My plan is to move E_xxx constants from Include/errcode.h to Include/internal/pycore_parser.h, and then remove the Include/errcode.h header filer.

@isidentical
Copy link
Member

Do you see any reason to keep the PyTokenizer as public?

I don't see any reason for external apps to depend on these methods, especially when we already have a pure Python version.

@vstinner vstinner merged commit 713bb19 into python:main Oct 13, 2021
@vstinner vstinner deleted the private_tokenize branch October 13, 2021 15:22
@vstinner
Copy link
Member Author

My plan is to move E_xxx constants from Include/errcode.h to Include/internal/pycore_parser.h, and then remove the Include/errcode.h header filer.

In fact, it's not possible without breaking the backward compatibility: https://bugs.python.org/issue45434#msg403841

@vstinner
Copy link
Member Author

vstinner commented Oct 13, 2021

But marking the tokenizer C API as private is still worth it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.