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

asyncore sillies #40384

Closed
mwhudson opened this issue Jun 11, 2004 · 7 comments
Closed

asyncore sillies #40384

mwhudson opened this issue Jun 11, 2004 · 7 comments

Comments

@mwhudson
Copy link

BPO 971200
Nosy @mwhudson, @tim-one

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 2004-06-14.10:36:08.000>
created_at = <Date 2004-06-11.15:19:06.000>
labels = []
title = 'asyncore sillies'
updated_at = <Date 2004-06-14.10:36:08.000>
user = 'https://github.com/mwhudson'

bugs.python.org fields:

activity = <Date 2004-06-14.10:36:08.000>
actor = 'mwh'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2004-06-11.15:19:06.000>
creator = 'mwh'
dependencies = []
files = []
hgrepos = []
issue_num = 971200
keywords = []
message_count = 7.0
messages = ['21142', '21143', '21144', '21145', '21146', '21147', '21148']
nosy_count = 3.0
nosy_names = ['mwh', 'tim.peters', 'anthonybaxter']
pr_nums = []
priority = 'high'
resolution = None
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue971200'
versions = []

@mwhudson
Copy link
Author

current cvs head, mac os x 10.2, debug build of python.

test_asynchat fails if and only if the compiled asyncore.pyc
file is present.

this makes no sense to me, but it's consistent.

@mwhudson
Copy link
Author

Logged In: YES
user_id=6656

Oh my:

>>> 1e309
Inf
[40577 refs]
>>> marshal.loads(marshal.dumps(1e309))
0.0
[40577 refs]

this must be the new "LC_NUMERIC agnostic" stuff, right?

@tim-one
Copy link
Member

tim-one commented Jun 11, 2004

Logged In: YES
user_id=31435

Well, what marshal (or pickle) do with an infinity (or NaN, or
the sign of a signed zero) is a platform accident. Here with
the released 2.3.4 on Windows (which doesn't have any
LC_NUMERIC changes):

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> 1e309
1.#INF
>>> import marshal
>>> marshal.loads(marshal.dumps(1e309))
1.0
>>>

So simply can't use a literal 1e309 in compiled code. There's
no portable way to spell infinity in Python. PEP-754 would
introduce a reasonably portable way, were it accepted.
Before then, 1e200*1e200 is probably the easiest reasonably
portable way -- but since behavior in the presence of an
infinity is accidental anyway, much better to avoid using
infinity at all in the libraries.

@mwhudson
Copy link
Author

Logged In: YES
user_id=6656

actually, i think the summary is that the most recent change to
asyncore is just broken. blaming the recent changes around
LC_NUMERIC and their effect or non-effect on marshal was a read
herring.

@anthonybaxter
Copy link
Mannequin

anthonybaxter mannequin commented Jun 12, 2004

Logged In: YES
user_id=29957

Is it worth making marshal issue a warning when someone
tries to store an infinity, in that case? It could (ha!) be
suprising that a piece of code that works from a .py fails
silently from a .pyc.

@tim-one
Copy link
Member

tim-one commented Jun 13, 2004

Logged In: YES
user_id=31435

marshal doesn't know whether the input is an infinity; that's
why the result is a platform-dependent accident; "infinity"
isn't a C89 concept, and Python inherits its ignorance from C

@mwhudson
Copy link
Author

Logged In: YES
user_id=6656

I think this can be closed now. A half-assed test could be
added to marshal (if (x!=x) PyErr_SetString(...)) but I'm
not sure it's worth it.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants