[issue16635] Interpreter not closing stdout/stderr on exit

2012-12-07 Thread Filip Zyzniewski

New submission from Filip Zyzniewski:

When using a Python script as a unix pipe filter with its stdout redirected to 
a file:

python script.py > /nfs/foo

user is not notified of some writing problems on NFS, because these are 
sometimes reported on close(), and the interpreter never does neither close(1) 
nor close(2):

$ strace -eclose python -c '' 2>&1 | grep  'close([12])'
$

--
components: IO
messages: 177090
nosy: filip.zyzniewski
priority: normal
severity: normal
status: open
title: Interpreter not closing stdout/stderr on exit
type: behavior
versions: Python 2.7, Python 3.2

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



[issue16635] Interpreter not closing stdout/stderr on exit

2012-12-07 Thread Filip Zyzniewski

Filip Zyzniewski added the comment:

If stdout was closed before closing stderr, then stdout problems could be 
reported, and that is what I would expect when using Python this way.

os.fsync(1) helps, but only if preceeded by sys.stdout.flush() and it seems a 
bit cumbersome.

Is there any downside to doing close(1) explicitely?

cat, grep, dd and echo close their stdout, why couldn't Python do this?

--

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



[issue19162] datetime.datetime.min.strftime('%Y') not working

2013-10-04 Thread Filip Zyzniewski

New submission from Filip Zyzniewski:

The datetime class provides a min datetime object which is not formattable:

on Python 2:

$ python
Python 2.7.3 (default, Apr 10 2013, 05:13:16) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.min.strftime('%Y')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year=1 is before 1900; the datetime strftime() methods require year 
>= 1900
>>> 

and on Python 3:

$ python3
Python 3.2.3 (default, Apr 10 2013, 05:07:54) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.min.strftime('%Y')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year=1 is before 1000; the datetime strftime() methods require year 
>= 1000
>>>

It seems to me that either datetime.datetime.min.year should be increased to 
1900/1000 or strftime should be able to format year=1 - it is strange that the 
API doesn't support its own constants.

--
components: Library (Lib)
messages: 198941
nosy: filip.zyzniewski
priority: normal
severity: normal
status: open
title: datetime.datetime.min.strftime('%Y') not working
type: behavior
versions: Python 2.7, Python 3.2

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



[issue4037] doctest.py should include method descriptors when looking inside a class __dict__

2013-12-11 Thread Filip Zyzniewski

Filip Zyzniewski added the comment:

It seems like there is also an issue with property classes defined in a 
different module.

In the example below Foo.x uses standard property, and Foo.y uses prop imported 
from the prop module.

This results in docstring for Foo.y to be missed:

filip@klocek:~/test$ cat prop.py
class prop(property):
pass
filip@klocek:~/test$ cat foo.py
from prop import prop

class Foo(object):

@property
def x(self):
"""
>>> Foo().x
'x'
"""
return 'x'

@prop
def y(self):
"""
>>> Foo().y
'y'
"""
return 'y'
filip@klocek:~/test$ python --version
Python 2.7.3
filip@klocek:~/test$ python -m doctest foo.py -v
Trying:
Foo().x
Expecting:
'x'
ok
2 items had no tests:
foo
foo.Foo
1 items passed all tests:
   1 tests in foo.Foo.x
1 tests in 3 items.
1 passed and 0 failed.
Test passed.
filip@klocek:~/test$ python3 --version
Python 3.2.3
filip@klocek:~/test$ python3 -m doctest foo.py -v
Trying:
Foo().x
Expecting:
'x'
ok
2 items had no tests:
foo
foo.Foo
1 items passed all tests:
   1 tests in foo.Foo.x
1 tests in 3 items.
1 passed and 0 failed.
Test passed.
filip@klocek:~/test$

--
nosy: +filip.zyzniewski

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