[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2011-03-18 Thread Carl Banks

New submission from Carl Banks :

The issue was raised by J Peyret on the following c.l.python thread:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/459e5ec433e7dcab?hl=en#

Several posters reported that the following code either hangs or crashes Python 
(versions 2.7, 2.6, and 3.2, on Windows and Linux) were tested:

-
class Foo(object):
pass

Foo.__repr__ = Foo.__str__

foo = Foo()
print(str(foo))
-

--
components: Interpreter Core
messages: 131364
nosy: aerojockey
priority: normal
severity: normal
status: open
title: Python crashes or hangs when rebinding __repr__ as __str__
type: crash
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue11603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2018-07-16 Thread Carl Banks


Carl Banks  added the comment:

I guess I'll weigh in since I was pinged.

I agree with the approach in the patch.  All the memoryview does is to use the 
format field verbatim from the underlying buffer, so if the format field is 
inaccurate then the only thing to do is to fix the object providing the buffer.

Since the format field is only there for interpretation of the data, and is not 
used to calculate of itemsizes or strides anywhere as far as I know, it's a 
fairly low-risk change.

However, the patch still leaves ctypes inaccurate for the case of unions.  It 
should be fairly simple to modify the code to use a format of "B" for 
unions, so that it at least matches the itemsize, even if the type information 
is lost.

(As an aside, let me point out that I did not actually write or advocate for 
the PEP; for some reason my name was added to it even though I all I did was to 
provide feedback.)

--

___
Python tracker 
<https://bugs.python.org/issue32780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com