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

ctypes.WinError() confuses errno with winerror #60373

Closed
sbt mannequin opened this issue Oct 8, 2012 · 2 comments
Closed

ctypes.WinError() confuses errno with winerror #60373

sbt mannequin opened this issue Oct 8, 2012 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@sbt
Copy link
Mannequin

sbt mannequin commented Oct 8, 2012

BPO 16169

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-10-09.14:09:59.161>
created_at = <Date 2012-10-08.22:08:17.379>
labels = ['type-bug']
title = 'ctypes.WinError() confuses errno with winerror'
updated_at = <Date 2012-10-09.14:09:59.160>
user = 'https://bugs.python.org/sbt'

bugs.python.org fields:

activity = <Date 2012-10-09.14:09:59.160>
actor = 'sbt'
assignee = 'none'
closed = True
closed_date = <Date 2012-10-09.14:09:59.161>
closer = 'sbt'
components = []
creation = <Date 2012-10-08.22:08:17.379>
creator = 'sbt'
dependencies = []
files = []
hgrepos = []
issue_num = 16169
keywords = []
message_count = 2.0
messages = ['172419', '172477']
nosy_count = 2.0
nosy_names = ['python-dev', 'sbt']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue16169'
versions = ['Python 3.3', 'Python 3.4']

@sbt
Copy link
Mannequin Author

sbt mannequin commented Oct 8, 2012

ctypes.WinError() is defined as

    def WinError(code=None, descr=None):
        if code is None:
            code = GetLastError()
        if descr is None:
            descr = FormatError(code).strip()
        return WindowsError(code, descr)

Since WindowsError became an alias for OSError, this means that if e is the exception raised, e.errno == GetLastError() and e.winerror == None.

I think the last line should be

        return WindowsError(None, descr, None, code)

@sbt sbt mannequin added the type-bug An unexpected behavior, bug, or error label Oct 8, 2012
@python-dev
Copy link
Mannequin

python-dev mannequin commented Oct 9, 2012

New changeset a3d65edc3b04 by Richard Oudkerk in branch '3.3':
Issue bpo-16169: Fix ctypes.WinError()'s confusion between errno and winerror
http://hg.python.org/cpython/rev/a3d65edc3b04

New changeset d3c4dcd9a048 by Richard Oudkerk in branch 'default':
Issue bpo-16169: Merge
http://hg.python.org/cpython/rev/d3c4dcd9a048

@sbt sbt mannequin closed this as completed Oct 9, 2012
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants