Issue 35802: os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat') (original) (raw)
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/79983
classification
Title: | os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat') | ||
---|---|---|---|
Type: | Stage: | resolved | |
Components: | Library (Lib) | Versions: | Python 3.8 |
process
Status: | closed | Resolution: | |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | Anthony Sottile, giampaolo.rodola, gregory.p.smith | |
Priority: | normal | Keywords: | patch, patch |
Created on 2019-01-21 21:42 by Anthony Sottile, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 11643 | merged | Anthony Sottile,2019-01-21 21:59 | |
PR 11643 | merged | Anthony Sottile,2019-01-21 21:59 |
Messages (5) | ||
---|---|---|
msg334182 - (view) | Author: Anthony Sottile (Anthony Sottile) * | Date: 2019-01-21 21:42 |
Unless I'm reading incorrectly: https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L30-L31 https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L68-L69 | ||
msg334184 - (view) | Author: Anthony Sottile (Anthony Sottile) * | Date: 2019-01-21 21:50 |
looks true for os.chmod as well: https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L327-L328 | ||
msg334226 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2019-01-22 18:34 |
I suspect these conditionals are very old and came from times when we supported some platforms that did not have these APIs. Are they present on all CPython supported platforms today? Windows is probably the only one left to verify. BSD/Linux/Un*xes and modern macOS are POSIX. macOS <= 9 (classic) has long since died. | ||
msg334229 - (view) | Author: Anthony Sottile (Anthony Sottile) * | Date: 2019-01-22 19:23 |
yep! did my due diligence there, you can check my work on https://github.com/python/cpython/pull/11643 all platforms have these functions since `posixmodule.c` is always compiled and the functions in question are not guarded by preprocessor directives in any way | ||
msg336584 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2019-02-26 00:07 |
A BB failed. Looks like it's unrelated with this change: https://buildbot.python.org/all/#/builders/99/builds/2198 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:10 | admin | set | github: 79983 |
2019-02-26 00:07:17 | giampaolo.rodola | set | keywords:patch, patchnosy: + giampaolo.rodolamessages: + |
2019-02-25 22:55:35 | Anthony Sottile | set | status: open -> closedstage: patch review -> resolved |
2019-01-22 19:23:36 | Anthony Sottile | set | messages: + |
2019-01-22 18:34:30 | gregory.p.smith | set | keywords:patch, patchnosy: + gregory.p.smithmessages: + |
2019-01-21 21:59:44 | Anthony Sottile | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest11423> |
2019-01-21 21:59:41 | Anthony Sottile | set | keywords: + patchstage: (no value)pull_requests: + <pull%5Frequest11422> |
2019-01-21 21:50:09 | Anthony Sottile | set | messages: + |
2019-01-21 21:42:34 | Anthony Sottile | create |