[issue10815] Write to /dev/full does not raise IOError

2011-01-03 Thread Michal Vyskocil

New submission from Michal Vyskocil mvysko...@suse.cz:

Write to /dev/full in python3 don't raise IOError. Python2 works as expected, 
the close call causes an IOError exception with no space left on device message.

$ python
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type help, copyright, credits or license for more information.
 f = open('/dev/full', 'w')
 f.write('s')
 f.close()
Traceback (most recent call last):
  File stdin, line 1, in module
IOError: [Errno 28] No space left on device

However using python3 I don't get an IOError after close
$ python3
Python 3.1.2 (r312:79147, Nov 20 2010, 11:33:28) 
[GCC 4.5.1 20101001 [gcc-4_5-branch revision 164883]] on linux2
Type help, copyright, credits or license for more information.
 f = open('/dev/full', 'w')
 f.write('s')
1
 f.close()

The only one way how to raise IOError in python3 is call f.flush()

...
 f.write('s')
1
 f.flush()
Traceback (most recent call last):
  File stdin, line 1, in module
IOError: [Errno 28] No space left on device

Documentation of io.IOBase.close() [1] said Flush and close this stream, so one 
should expect calls f.flush();f.close() will be the same as plain f.close().

[1] http://docs.python.org/py3k/library/io.html

--
components: IO
messages: 125175
nosy: mvyskocil
priority: normal
severity: normal
status: open
title: Write to /dev/full does not raise IOError
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10815
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6740] Compounded expressions with lambda functions are evaluated incorrectly

2009-08-20 Thread Michal Vyskocil

New submission from Michal Vyskocil mvysko...@suse.cz:

The compounded expressions with lambda functions are evaluated
incorrectly. The simple expressions, or a named functions are evaluated
good. The problem is only in the evaluation of compounded expressions.
It seems that after evaluate of the first lambda function the
evaluation of whole expression is stopped and not continue (see
cond_error, which may raises the exception during evaluation).

Python 3.1 (r31:73572, Aug 15 2009, 22:04:19)
[GCC 4.4.1 [gcc-4_4-branch revision 149935]] on linux2
Type help, copyright, credits or license for more information.
 cond = (lambda x : x == 'foo') or (lambda x : x == 'bar')
 cond('foo')
True
 cond('bar')
False
 c1 = lambda x : x == 'foo'
 c1('foo')
True
 c2 = lambda x : x == 'bar'
 c2('bar')
True
 def ham(x): return x == 'foo'
...
 def spam(x): return x == 'bar'
...
 cond2 = lambda x : ham(x) or spam(x)
 cond2('foo')
True
 cond2('bar')
True
 cond2('ham')
False
 cond_error = (lambda x : x == 'foo') or (lambda x : y == 'bar')
 cond_error('d')
False

BTW: the same problem exists in Python 2.6.2
Python 2.6.2 (r262:71600, Aug 15 2009, 18:37:04)
[GCC 4.4.1 [gcc-4_4-branch revision 149935]] on linux2
Type help, copyright, credits or license for more information.

--
messages: 91766
nosy: mvyskocil
severity: normal
status: open
title: Compounded expressions with lambda functions are evaluated incorrectly
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6740
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil

New submission from Michal Vyskocil:

pprint._safe_repr for type str uses much slower codepath by default, which does 
not makes a sense in Python3 context. Instead of simply using repr, it check 
the existence of 'locale' in sys.modules and if found, it goes one-by-one-char 
call str.isalpha() on each and apply the quoting for non-alpha chars. This is 
extremely slow, but as locale is usually in sys.modules, it's used by default.

The point of such code was because in python2, str.isalpha() depends on locale, 
so for locale-aware Python builds, there was a different path needed. But this 
does not apply for Python3, where all strings are unicode, so .isaplha() is not 
locale sensitive anymore.

--
components: Library (Lib)
files: pprint-remove-bogus-code.patch
keywords: patch
messages: 194652
nosy: mvyskocil
priority: normal
severity: normal
status: open
title: [PATCH] remove bogus codepath from pprint._safe_repr
type: performance
Added file: http://bugs.python.org/file31193/pprint-remove-bogus-code.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18682
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil

Michal Vyskocil added the comment:

This is simple code checks if .isalnum is or is not locale sensitive and a 
small measurement of how much is the repr faster, compared to old codepath.

BTW: python3 test_pprint.py on patched version have succeeded

OK (expected failures=1)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18682
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil

Changes by Michal Vyskocil mvysko...@suse.cz:


Added file: http://bugs.python.org/file31194/check.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18682
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-15 Thread Michal Vyskocil

Michal Vyskocil added the comment:

The fast scalars approach looks great!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18682
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com