Skip to content

gh-117657: Move static variables in fileutils.c to thread state #120559

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove all other references of it
  • Loading branch information
Fidget-Spinner committed Jun 15, 2024
commit 19e1624d83e4bac0b10afebef910f94b3dd95d6c
7 changes: 2 additions & 5 deletions Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *) self;
}

#ifdef O_CLOEXEC
extern int _Py_open_cloexec_works;
#endif

/*[clinic input]
_io.FileIO.__init__
file as nameobj: object
Expand Down Expand Up @@ -247,7 +243,8 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
int fd = -1;
int fd_is_own = 0;
#ifdef O_CLOEXEC
int *atomic_flag_works = &_Py_open_cloexec_works;
PyThreadState *tstate = PyThreadState_Get();
int *atomic_flag_works = &tstate->fileutils__Py_open_cloexec_works;
#elif !defined(MS_WINDOWS)
int *atomic_flag_works = NULL;
#endif
Expand Down
7 changes: 2 additions & 5 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -10969,10 +10969,6 @@ os_tcsetpgrp_impl(PyObject *module, int fd, pid_t pgid)

/* Functions acting on file descriptors */

#ifdef O_CLOEXEC
extern int _Py_open_cloexec_works;
#endif


/*[clinic input]
os.open -> int
Expand Down Expand Up @@ -11003,7 +10999,8 @@ os_open_impl(PyObject *module, path_t *path, int flags, int mode, int dir_fd)
#endif

#ifdef O_CLOEXEC
int *atomic_flag_works = &_Py_open_cloexec_works;
PyThreadState *tstate = PyThreadState_Get();
int *atomic_flag_works = &tstate->fileutils__Py_open_cloexec_works;
#elif !defined(MS_WINDOWS)
int *atomic_flag_works = NULL;
#endif
Expand Down
4 changes: 0 additions & 4 deletions Tools/c-analyzer/cpython/ignored.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ filename funcname name reason
## indicators for resource availability/capability
# (set during first init)
Python/bootstrap_hash.c py_getrandom getrandom_works -
Python/fileutils.c - _Py_open_cloexec_works -
Python/fileutils.c set_inheritable ioctl_works -
# (set lazily, *after* first init)
# XXX Is this thread-safe?
Modules/posixmodule.c os_dup2_impl dup3_works -
Expand Down Expand Up @@ -628,7 +626,6 @@ Include/py_curses.h - PyCurses_API -
Include/pydecimal.h - _decimal_api -
Modules/_blake2/blake2module.c - blake2b_type_spec -
Modules/_blake2/blake2module.c - blake2s_type_spec -
Modules/_io/fileio.c - _Py_open_cloexec_works -
Modules/_io/_iomodule.h - PyIOBase_Type -
Modules/_io/_iomodule.h - PyRawIOBase_Type -
Modules/_io/_iomodule.h - PyBufferedIOBase_Type -
Expand Down Expand Up @@ -677,7 +674,6 @@ Modules/_sqlite/module.c - _pysqlite_enable_callback_tracebacks -
Modules/_sqlite/module.c - pysqlite_BaseTypeAdapted -
Modules/_sqlite/module.h - pysqlite_global_state -
Modules/_testcapimodule.c - _PyBytesIOBuffer_Type -
Modules/posixmodule.c - _Py_open_cloexec_works -
Modules/posixmodule.c - environ -
Objects/object.c - _Py_GenericAliasIterType -
Objects/object.c - _PyMemoryIter_Type -
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy