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

__reduce_ex__ on lock object #63232

Closed
cool-RR mannequin opened this issue Sep 16, 2013 · 7 comments
Closed

__reduce_ex__ on lock object #63232

cool-RR mannequin opened this issue Sep 16, 2013 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@cool-RR
Copy link
Mannequin

cool-RR mannequin commented Sep 16, 2013

BPO 19032
Nosy @rhettinger, @pitrou, @cool-RR

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 2013-09-18.08:56:38.407>
created_at = <Date 2013-09-16.00:43:04.864>
labels = ['type-bug', 'library']
title = '__reduce_ex__ on lock object'
updated_at = <Date 2013-09-18.08:56:38.406>
user = 'https://github.com/cool-RR'

bugs.python.org fields:

activity = <Date 2013-09-18.08:56:38.406>
actor = 'cool-RR'
assignee = 'none'
closed = True
closed_date = <Date 2013-09-18.08:56:38.407>
closer = 'cool-RR'
components = ['Library (Lib)']
creation = <Date 2013-09-16.00:43:04.864>
creator = 'cool-RR'
dependencies = []
files = []
hgrepos = []
issue_num = 19032
keywords = []
message_count = 7.0
messages = ['197850', '197880', '197887', '197892', '197893', '197895', '198005']
nosy_count = 3.0
nosy_names = ['rhettinger', 'pitrou', 'cool-RR']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue19032'
versions = ['Python 3.3']

@cool-RR
Copy link
Mannequin Author

cool-RR mannequin commented Sep 16, 2013

>>> import threading
    >>> l = threading.Lock()
    >>> l.__reduce_ex__(3)
    (<function __newobj__ at 0x00000000026CD8C8>,
     (<class '_thread.lock'>,),
     None,
     None,
     None)

Isn't it a bug that __reduce_ex__ works on the non-pickleable lock object?

@cool-RR cool-RR mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 16, 2013
@pitrou
Copy link
Member

pitrou commented Sep 16, 2013

I don't really know. It simply looks like the default implementation of __reduce_ex__. Is it important?

@cool-RR
Copy link
Mannequin Author

cool-RR mannequin commented Sep 16, 2013

I use that to test whether an object is pickleable or not. It used to work in Python 2.

@pitrou
Copy link
Member

pitrou commented Sep 16, 2013

I use that to test whether an object is pickleable or not. It used to
work in Python 2.

Well, the obvious way to do it would be to call pickle.dumps() on
the object, IMO :-)

@cool-RR
Copy link
Mannequin Author

cool-RR mannequin commented Sep 16, 2013

Wrong, because the object itself could be pickleable but refer to a different object which is non-pickleable. I want to know whether the object itself, without any object it refers to, is pickleable.

Also, pickling an object could be very resource-intensive, depending on its size.

@pitrou
Copy link
Member

pitrou commented Sep 16, 2013

Wrong, because the object itself could be pickleable but refer to a
different object which is non-pickleable. I want to know whether the
object itself, without any object it refers to, is pickleable.

I think you're being too picky. Unless you're manually added stuff
to your Lock's attributes, there isn't a practical difference between
the two situations.

Also, pickling an object could be very resource-intensive, depending
on its size.

Well, this is a Lock here, not an ISO file.

@rhettinger
Copy link
Contributor

This does not look like a bug to me.
I think this should be closed.

@cool-RR cool-RR mannequin closed this as completed Sep 18, 2013
@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
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants