This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年11月28日 06:37 by simonzack, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg231796 - (view) | Author: Simon Zack (simonzack) | Date: 2014年11月28日 06:37 | |
The ctypes.WinError function returns: OSError(None, descr, None, code) However OSError does not appear to allow None as a first argument, and converts it to 22 which is the EINVAL "Invalid Argument" error. This is rather confusing as there was no invalid argument errors in the code. I think the behaviour for one of WinError and OSError should be modified so that the handling of errno is more compatible. |
|||
| msg231805 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2014年11月28日 11:06 | |
No, OSError.errno is converted from the Windows error code. There is a translation map (see PC/errmap.h, built with the _dosmaperr() function) and the default value is EINVAL. It's working as intended. What was the winerror code? do you think it should be mapped to another errno? |
|||
| msg231806 - (view) | Author: Simon Zack (simonzack) | Date: 2014年11月28日 11:28 | |
Ok, my bad, I was creating my own OSErrors so I was just testing it out. I just found the default to be rather confusing as I thought None would not be mapped to anything. |
|||
| msg231823 - (view) | Author: Eryk Sun (eryksun) * (Python triager) | Date: 2014年11月28日 19:10 | |
> the default value is EINVAL. Should that be specified in the docs? Currently it states that "[t]he errno attribute is then an approximate translation, in POSIX terms, of that native error code". https://docs.python.org/3/library/exceptions.html#OSError |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:10 | admin | set | github: 67150 |
| 2021年02月23日 11:28:38 | eryksun | set | status: open -> closed resolution: not a bug stage: resolved |
| 2014年11月28日 19:10:02 | eryksun | set | nosy:
+ eryksun messages: + msg231823 |
| 2014年11月28日 11:28:22 | simonzack | set | messages: + msg231806 |
| 2014年11月28日 11:06:43 | amaury.forgeotdarc | set | messages: + msg231805 |
| 2014年11月28日 08:15:37 | ned.deily | set | nosy:
+ amaury.forgeotdarc, belopolsky, meador.inge |
| 2014年11月28日 06:37:43 | simonzack | set | components:
+ ctypes versions: + Python 3.4 |
| 2014年11月28日 06:37:34 | simonzack | create | |