[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread Dave Opstad

New submission from Dave Opstad :

Python 2.7.1 doesn't appear to do the usual implicit call to str() for 
subclasses of unicode. In the following snippet, I would have expected print 
myTest and print str(myTest) to behave the same:

>>> class Test(unicode):
...   def __str__(self):
... print "In __str__"
... return (u"*** " + self + u" ***").encode('utf-8')
...   def __unicode__(self):
... print "In __unicode__"
... return u"*** " + self + u" ***"
... 
>>> myTest = Test(u"abc")
>>> print myTest
abc
>>> print str(myTest)
In __str__
*** abc ***
>>> print unicode(myTest)
In __unicode__
*** abc ***

--
components: Unicode
messages: 134231
nosy: opstad
priority: normal
severity: normal
status: open
title: 2.7.1 unicode subclasses not calling __str__() for print statement
type: behavior
versions: Python 2.7

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



[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-04-21 Thread Dave Opstad

Dave Opstad  added the comment:

I guess I was confused by the inconsistency with Python 3, which *does* call 
the __str__ method, even though, again, no coercion is needed:

Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class X(str):
...   def __str__(self):
... print("In __str__")
... return "*** " + self + " ***"
... 
>>> x = X("abcde")
>>> print(x)
In __str__
*** abcde ***
>>> print(str(x))
In __str__
*** abcde ***

--

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



[issue32488] Fatal error using pydoc

2018-01-03 Thread Dave Opstad

New submission from Dave Opstad :

I'm running 3.6.4 on Mac OS X 10.13.2, bash shell. Doing:

$ pydoc modules

causes:

Please wait a moment while I gather a list of all available modules...

Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

Reproduced this several times with the same result.

--
components: Demos and Tools
messages: 309422
nosy: opstad
priority: normal
severity: normal
status: open
title: Fatal error using pydoc
type: crash
versions: Python 3.6

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



[issue32488] Fatal error using pydoc

2018-01-03 Thread Dave Opstad

Dave Opstad  added the comment:

I think this was my mistake; when I used pydoc3 instead of pydoc it ran to 
completion. Please feel free to close this; sorry for the noise.

--

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



[issue34208] Change in 3.7 expression evaluation?

2018-07-24 Thread Dave Opstad


New submission from Dave Opstad :

In 3.6 I get this:

>>> x = (100 * 20)
>>> x is 2000
False
>>> (100 * 20) is 2000
False

But in 3.7, I get this:

>>> x = (100 * 20)
>>> x is 2000
False
>>> (100 * 20) is 2000
True

This isn't necessarily a problem, but I'm curious why this behavior changed 
from 3.6 to 3.7.

--
components: Interpreter Core
messages: 322304
nosy: opstad
priority: normal
severity: normal
status: open
title: Change in 3.7 expression evaluation?
type: behavior
versions: Python 3.7

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



[issue8941] utf-32be codec failing on 16-bit python build for 32-bit value

2010-06-08 Thread Dave Opstad

New submission from Dave Opstad :

The utf-32 little-endian codec works fine, but the big-endian codec is 
producing incorrect results:

Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b'\x00\x00\x01\x00', 'utf-32le') # works
'\U0001'
>>> str(b'\x00\x01\x00\x00', 'utf-32be') # doesn't work
'\ud800\x02'

--
components: Unicode
messages: 107326
nosy: opstad
priority: normal
severity: normal
status: open
title: utf-32be codec failing on 16-bit python build for 32-bit value
type: behavior
versions: Python 3.1

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



[issue8946] PyBuffer_Release signature in 3.1 documentation is incorrect

2010-06-08 Thread Dave Opstad

New submission from Dave Opstad :

According to the 3.1 documentation, the prototype for PyBuffer_Release is:

void PyBuffer_Release(PyObject *obj, Py_buffer *view);

However, abstract.h has this prototype:

PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);

The documentation's reference to "obj" should be removed.

--
assignee: d...@python
components: Documentation
messages: 107342
nosy: d...@python, opstad
priority: normal
severity: normal
status: open
title: PyBuffer_Release signature in 3.1 documentation is incorrect
type: behavior
versions: Python 3.1

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