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

Pickling and copying ImportError doesn't preserve name and path #74184

Closed
serhiy-storchaka opened this issue Apr 5, 2017 · 4 comments
Closed
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 29998
Nosy @brettcannon, @ncoghlan, @ericsnowcurrently, @serhiy-storchaka
PRs
  • bpo-29998: Pickling and copying ImportError now preserves name and path #1010
  • bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) #1042
  • bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) #1043
  • 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 2017-04-08.08:28:27.024>
    created_at = <Date 2017-04-05.20:34:35.941>
    labels = ['interpreter-core', 'type-bug', '3.7']
    title = "Pickling and copying ImportError doesn't preserve name and path"
    updated_at = <Date 2017-04-08.08:28:27.024>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-04-08.08:28:27.024>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-04-08.08:28:27.024>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2017-04-05.20:34:35.941>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 29998
    keywords = []
    message_count = 4.0
    messages = ['291194', '291324', '291327', '291328']
    nosy_count = 4.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'eric.snow', 'serhiy.storchaka']
    pr_nums = ['1010', '1042', '1043']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29998'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    Pickling and copying ImportError doesn't preserve name and path attributes.

    >>> import copy, pickle
    >>> e = ImportError('test', name='n', path='p')
    >>> e.name
    'n'
    >>> e.path
    'p'
    >>> e2 = pickle.loads(pickle.dumps(e, 4))
    >>> e2.name
    >>> e2.path
    >>> e2 = copy.copy(e)
    >>> e2.name
    >>> e2.path

    Proposed patch fixes this.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Apr 5, 2017
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset b785396 by Serhiy Storchaka in branch 'master':
    bpo-29998: Pickling and copying ImportError now preserves name and path (bpo-1010)
    b785396

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset af685f9 by Serhiy Storchaka in branch '3.6':
    bpo-29998: Pickling and copying ImportError now preserves name and path (bpo-1010) (bpo-1042)
    af685f9

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset e63f8f2 by Serhiy Storchaka in branch '3.5':
    bpo-29998: Pickling and copying ImportError now preserves name and path (bpo-1010) (bpo-1043)
    e63f8f2

    @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
    3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant