[issue1420] Unicode literals in tokenize.py and tests.

2007-11-11 Thread Ron Adam

New submission from Ron Adam:

Replaced Unicode literals in tokenize.py and it's tests files with byte
literals.

Added a compile step to the test to make sure the text file used in the
test are valid python code.  This will catch changes that need to be
done in to the text (gold file) for future python versions.

--
components: Library (Lib)
files: tokenize_patch.diff
messages: 57366
nosy: ron_adam
severity: normal
status: open
title: Unicode literals in tokenize.py and tests.
versions: Python 3.0
Added file: http://bugs.python.org/file8732/tokenize_patch.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1420
__Index: Lib/tokenize.py
===
--- Lib/tokenize.py	(revision 58930)
+++ Lib/tokenize.py	(working copy)
@@ -69,10 +69,10 @@
 Single3 = r[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''
 # Tail end of  string.
 Double3 = r'[^\\]*(?:(?:\\.|(?!))[^\\]*)*'
-Triple = group([uU]?[rR]?''', '[uU]?[rR]?')
+Triple = group([bB]?[rR]?''', '[bB]?[rR]?')
 # Single-line ' or  string.
-String = group(r[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*',
-   r'[uU]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*')
+String = group(r[bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*',
+   r'[bB]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*')
 
 # Because of leftmost-then-longest match semantics, be sure to put the
 # longest operators first (e.g., if = came before ==, == would get
@@ -90,9 +90,9 @@
 Token = Ignore + PlainToken
 
 # First (or only) line of ' or  string.
-ContStr = group(r[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)* +
+ContStr = group(r[bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)* +
 group(', r'\\\r?\n'),
-r'[uU]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*' +
+r'[bB]?[rR]?[^\n\\]*(?:\\.[^\n\\]*)*' +
 group('', r'\\\r?\n'))
 PseudoExtras = group(r'\\\r?\n', Comment, Triple)
 PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)
@@ -102,28 +102,28 @@
 endprogs = {': re.compile(Single), '': re.compile(Double),
 ''': single3prog, '': double3prog,
 r''': single3prog, 'r': double3prog,
-u''': single3prog, 'u': double3prog,
-ur''': single3prog, 'ur': double3prog,
+b''': single3prog, 'b': double3prog,
+br''': single3prog, 'br': double3prog,
 R''': single3prog, 'R': double3prog,
-U''': single3prog, 'U': double3prog,
-uR''': single3prog, 'uR': double3prog,
-Ur''': single3prog, 'Ur': double3prog,
-UR''': single3prog, 'UR': double3prog,
-'r': None, 'R': None, 'u': None, 'U': None}
+B''': single3prog, 'B': double3prog,
+bR''': single3prog, 'bR': double3prog,
+Br''': single3prog, 'Br': double3prog,
+BR''': single3prog, 'BR': double3prog,
+'r': None, 'R': None, 'b': None, 'B': None}
 
 triple_quoted = {}
 for t in (''', '',
   r''', 'r', R''', 'R',
-  u''', 'u', U''', 'U',
-  ur''', 'ur', Ur''', 'Ur',
-  uR''', 'uR', UR''', 'UR'):
+  b''', 'b', B''', 'B',
+  br''', 'br', Br''', 'Br',
+  bR''', 'bR', BR''', 'BR'):
 triple_quoted[t] = t
 single_quoted = {}
 for t in (', '',
   r', 'r', R', 'R',
-  u', 'u', U', 'U',
-  ur', 'ur', Ur', 'Ur',
-  uR', 'uR', UR', 'UR' ):
+  b', 'b', B', 'B',
+  br', 'br', Br', 'Br',
+  bR', 'bR', BR', 'BR' ):
 single_quoted[t] = t
 
 tabsize = 8
Index: Lib/test/test_tokenize.py
===
--- Lib/test/test_tokenize.py	(revision 58930)
+++ Lib/test/test_tokenize.py	(working copy)
@@ -183,17 +183,26 @@
 
 next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
 
+# Validate the tokenize_tests.txt file.
+# This makes sure it's compiles and displays any errors in it.
+f = open(findfile('tokenize_tests.txt'))
+sf = f.read()
+f.close()
+cf = compile(sf, 'tokenize_tests.txt', 'exec')
+
 # This displays the tokenization of tokenize_tests.py to stdout, and
 # regrtest.py checks that this equals the expected output (in the
 # test/output/ directory).
 f = open(findfile('tokenize_tests.txt'))
 tokenize(f.readline)
 f.close()
-
-# Now run test_roundtrip() over tokenize_test.py too, and over all
+   
+# Now run test_roundtrip() over test_tokenize.py too, and over all
 # (if the compiler resource is enabled) or a small random sample (if
 # compiler is not enabled) of the test*.py files.
-f = findfile('tokenize_tests.txt')
+f = findfile('test_tokenize.py')
+if verbose:
+print('round trip: ', f, file=sys.__stdout__)
 test_roundtrip(f)
 
 testdir = os.path.dirname(f) or os.curdir
Index: Lib/test/tokenize_tests.txt

[issue1421] python.org: outdated and false information

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

Short of a bug tracker for errors on python.org I'm using this bug
tracker to support some problems.

http://www.python.org/dev/process/
Documenting Python still mentions LaTeX as the system for
documentation of Python.

http://www.python.org/dev/implementations/
Python for .NET is either describing a totally different project or
the author  of the chapter didn't understand the design goals of Python
for .NET written by Brian Lloyd. It's a bridge between CPython and
.NET/Mono that allows developers to use CPython code and C extensions in
.NET or .NET assemblies in CPython. Compiling Python code to CLR / IL
byte code is not the intention of the project.
The project homepage is wrong (http://pythonnet.sourceforge.net/) and
the project is still maintained. I myself has fixed several bugs this
summer and ported it to Python 2.5, Python 2.6, UCS-4 builds of Python
and Mono.

--
components: Documentation
messages: 57367
nosy: tiran
priority: high
severity: normal
status: open
title: python.org: outdated and false information

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1421
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1395] py3k: duplicated line endings when using read(1)

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

By the way I've found the daily builds you were asking for, Raghuram.
http://www.python.org/dev/daily-msi/ :)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1395
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1419] ssl module version 1.10 causes TypeError when accepting connection

2007-11-11 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  - janssen
nosy: +janssen

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1419
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1422] Writing to an invalid fd doesn't raise an exception

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

The bug is related to http://bugs.python.org/issue1415 and occurs only
with the latest patch from #1415.

Writing to an invalid fd doesn't raise an exception:

 f = open(100, 'w')
 f.fileno()
100
 f.write(test)
4

However reading or opening an invalid fd for reading and writing raises
an exception.

 f = open(100, 'r')
 f.read()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/heimes/dev/python/py3k/Lib/io.py, line 1253, in read
res += decoder.decode(self.buffer.read(), True)
  File /home/heimes/dev/python/py3k/Lib/io.py, line 756, in read
current = self.raw.read(to_read)
IOError: [Errno 9] Bad file descriptor
 f = open(100, 'w+')
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/heimes/dev/python/py3k/Lib/io.py, line 195, in __new__
return open(*args, **kwargs)
  File /home/heimes/dev/python/py3k/Lib/io.py, line 169, in open
buffer = BufferedRandom(raw, buffering)
  File /home/heimes/dev/python/py3k/Lib/io.py, line 948, in __init__
raw._checkSeekable()
  File /home/heimes/dev/python/py3k/Lib/io.py, line 301, in _checkSeekable
if msg is None else msg)
IOError: File or stream is not seekable.

I expected that fileio_write() raises an exception when fd is invalid:

n = write(self-fd, ptr, n);
if (n  0) {
if (errno == EAGAIN)
Py_RETURN_NONE;
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

--
assignee: tiran
components: Interpreter Core
keywords: py3k
messages: 57372
nosy: tiran
priority: normal
severity: normal
status: open
title: Writing to an invalid fd doesn't raise an exception
type: behavior
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1422
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1415] py3k: pythonw.exe fails because std streams a missing

2007-11-11 Thread Guido van Rossum

Guido van Rossum added the comment:

Hmm... In internal_close() there's still a test for self-fd = 0. I'm
not sure if this is an oversight or intentional.

Also, I don't understand under what circumstances fds  0 can occur. I
presume this is only on Windows. Can you point me to docs for this
fact?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1415
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1415] py3k: pythonw.exe fails because std streams a missing

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
 Hmm... In internal_close() there's still a test for self-fd = 0. I'm
 not sure if this is an oversight or intentional.

I'll check it later.

The patch still contains some debugging code that redirects stdout and
stderr to a file when PY_STDERR_FILE is defined.

 Also, I don't understand under what circumstances fds  0 can occur. I
 presume this is only on Windows. Can you point me to docs for this
 fact?

It happens when a script is run with pythonw.exe (pyw extension).
PythonW.exe isn't a console application but a GUI app which doesn't
create a console window. However GUI apps don't have valid standard
streams because stdin, stdout and stderr aren't connected.

Here are some links that shed some light on the problem:

http://mail.python.org/pipermail/python-dev/2001-January/011423.html
http://www.halcyon.com/~ast/dload/guicon.htm
http://msdn2.microsoft.com/en-us/library/3x292kth(VS.80).aspx

The patch creates another problem:
http://bugs.python.org/issue1422

Christian

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1415
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1417] Weakref not working properly

2007-11-11 Thread MHOOO

MHOOO added the comment:

Well, too bad.
My workaround (to make weakrefs work) is attached as a file.

Added file: http://bugs.python.org/file8733/myhacks.py

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1417
__ Some hacks.

Written by Thomas Karolski ([EMAIL PROTECTED]).

Last edit: 11.11.07



def getframe(level=0):
	try:
		raise Exception() # make an error happen
	except: # and return the caller's frame
		import sys
		frame = sys.exc_traceback.tb_frame.f_back
		i = level
		while i  0:
			if not hasattr(frame,'f_back') or frame.f_back == None:
raise Exception(Can't get back +str(level)+ levels)
			frame = frame.f_back
			i += 1
		
		return frame

import types
import weakref
from functools import wraps
class WeaklyReferencableMethod:
	def __init__(self, method):
		self._im_self = weakref.ref(method.im_self)
		self._im_class = method.im_class
		self._im_func = method.im_func 
		#update_wrapper(self._im_func, method)
		
	im_self = property(fget=lambda s: s._im_self())
	im_class = property(fget=lambda s: s._im_class)
	im_func = property(fget=lambda s: s._im_func)
		
	def __call__(self, *args, **dargs):
		return self.im_func(self.im_self, *args, **dargs)
	
import types
def weakrefhack( what ):
	weakrefhack( method )
	Checks whether method exists as an attribute inside
	method.im_self. If it does, a wrapper function is created
	which calls a WeaklyReferencableMethod class. The class
	only stores a weak reference to the original methods object
	instance (im_self). Thus we get 'real' weakly referencable
	methods.
	
	class A:
		def method( self ): pass
	a = A()
	referencable = weakrefhack(a.method)
	# referencable is a.method now
	ref = weakref.ref(a.method)
	what_type = type(what)
	
	if what_type==types.MethodType:
		for attrname in dir(what.im_self):
			if getattr(what.im_self, attrname)==what:
wrm = WeaklyReferencableMethod(what)
@wraps(what)
def wrapper(*args, **dargs):
	wrm(*args, **dargs)
wrapper.im_self = wrm.im_self
wrapper.im_func = wrm.im_func
wrapper.im_class = wrm.im_class
setattr(what.im_self, attrname, wrapper)
return wrapper

#import weakref
#class a:
#	def m():
#		pass
#
#mya = a()
#weakrefhack(mya.m)
#ref = weakref.ref(mya.m)
#print ref
#ref = weakref.ref(mya.m)
#print ref___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1422] Writing to an invalid fd doesn't raise an exception

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

Python 2.5 and probably 2.6 suffer from the same problem although it's
harder to trigger it.

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type help, copyright, credits or license for more information.
 import os
 f = open(/tmp/test, 'w')
 f.fileno()
3
 os.close(f.fileno())
 f.write(test)
 f.write(test)

close failed: [Errno 9] Bad file descriptor
$ ls -la /tmp/test
-rw-r- 1 heimes heimes 0 2007-11-11 20:46 /tmp/test

--
versions: +Python 2.5, Python 2.6

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1422
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1423] wave sunau aifc 16bit errors

2007-11-11 Thread jeroen

New submission from jeroen:

When you write sound files wav sunau of aifc and you are using 16 bits
samples. The number of frames in the files is incorrect. close function
which updates the headers makes a mistake I assume. For the sunau type I
had to double the number of frames in the close function to make it correct.

If you do not correctg number of frames a 10 second file will play 5 seconds

--
components: Library (Lib)
messages: 57377
nosy: jeroen
severity: normal
status: open
title: wave sunau aifc 16bit errors
versions: Python 2.5

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1423
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1424] py3k: readline and rlcompleter doesn't list choices

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

Python 2.5:
 import readline; import rlcompleter; readline.parse_and_bind(tab:
complete)
 import sys
 sys.stdtabtab
sys.stderr  sys.stdin   sys.stdout

Python 3.0:
 import readline; import rlcompleter; readline.parse_and_bind(tab:
complete)
 import sys
 import sys.stdtabtab
# nothing

--
components: Extension Modules, Library (Lib)
keywords: py3k
messages: 57378
nosy: tiran
priority: low
severity: normal
status: open
title: py3k: readline and rlcompleter doesn't list choices
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1424
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1419] ssl module version 1.10 causes TypeError when accepting connection

2007-11-11 Thread Bill Janssen

Bill Janssen added the comment:

Good catch.  I found this in the 3K branch, but hadn't backported it to 
the SSL PyPI module yet.

--
resolution:  - accepted

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1419
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1419] ssl module version 1.10 causes TypeError when accepting connection

2007-11-11 Thread Bill Janssen

Bill Janssen added the comment:

I've uploaded a fixed ssl-1.12 to PyPI.

--
resolution: accepted - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1419
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425] readline: no display matches hook set

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

In Python 2.6 and 3.0 the readline module has changed. A new hook to set
a display matches was introduced but no default method is set thus
rendering  rlcompleter partly useless.

--
components: Extension Modules, Library (Lib)
keywords: py3k
messages: 57381
nosy: tiran
severity: normal
status: open
title: readline: no display matches hook set
versions: Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1425
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425] readline: no display matches hook set

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

http://bugs.python.org/issue1388440
http://bugs.python.org/issue1424

--
assignee:  - loewis
nosy: +loewis
priority:  - normal
superseder:  - py3k: readline and rlcompleter doesn't list choices

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1425
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1426] readline module needs a review

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

The readline module needs a review and cleanup. Several functions don't
do enough error checks and the indention is partly borked with mixes of
tab and 2 space indention.

--
keywords: py3k
messages: 57383
nosy: tiran
priority: high
severity: normal
status: open
title: readline module needs a review
versions: Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1426
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1427] Error in standard module calendar

2007-11-11 Thread Damjan Georgievski

New submission from Damjan Georgievski:

This is LocaleTextCalendar.__init__

def __init__(self, firstweekday=0, locale=None):
TextCalendar.__init__(self, firstweekday)
if locale is None:
locale = locale.getdefaultlocale()
self.locale = locale

Which can not work, obviosly ... let me hilight the important part
if locale is None:
locale = locale.getdefaultlocale()
???

Attached is a patch that corrects this and keeps the signature of the
method with the locale=None keyword.

--
components: Extension Modules
files: calendar.diff
messages: 57384
nosy: gdamjan
severity: normal
status: open
title: Error in standard module calendar
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file8734/calendar.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1427
__

calendar.diff
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1428] Update to property.__doc__

2007-11-11 Thread Christian Heimes

New submission from Christian Heimes:

The patch adds the new syntax to the doc string of property:

Decorators makes defining new or modifying existing properties easy:
class C(object):
@property
def x(self): return self.__x
@x.setter
def x(self, value): self.__x = value
@x.deleter
def x(self): del self.__x

--
assignee: gvanrossum
components: Interpreter Core
files: property_docstring.patch
keywords: patch
messages: 57385
nosy: gvanrossum, tiran
priority: low
severity: normal
status: open
title: Update to property.__doc__
type: rfe
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file8735/property_docstring.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1428
__Index: Objects/descrobject.c
===
--- Objects/descrobject.c	(Revision 58931)
+++ Objects/descrobject.c	(Arbeitskopie)
@@ -1271,7 +1271,17 @@
 def getx(self): return self.__x\n
 def setx(self, value): self.__x = value\n
 def delx(self): del self.__x\n
-x = property(getx, setx, delx, \I'm the 'x' property.\));
+x = property(getx, setx, delx, \I'm the 'x' property.\)\n
+\n
+Decorators makes defining new or modifying existing properties easy:\n
+class C(object):\n
+@property\n
+def x(self): return self.__x\n
+@x.setter\n
+def x(self, value): self.__x = value\n
+@x.deleter\n
+def x(self): del self.__x\n
+);
 
 static int
 property_traverse(PyObject *self, visitproc visit, void *arg)
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1427] Error in standard module calendar

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

My patch uses import locale as _locale to avoid ambiguous variables.
It also fixes some additional bugs. I still don't understand how
prweek() should work. self.week is missing.

--
keywords: +patch
nosy: +tiran
priority:  - normal
versions: +Python 2.6, Python 3.0
Added file: http://bugs.python.org/file8736/calendar.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1427
__--- /usr/lib/python2.5/calendar.py~	2007-11-04 02:44:03.0 +0100
+++ /usr/lib/python2.5/calendar.py	2007-11-04 02:49:10.0 +0100
@@ -502,9 +502,11 @@
 
 def __init__(self, firstweekday=0, locale=None):
 TextCalendar.__init__(self, firstweekday)
-if locale is None:
-locale = locale.getdefaultlocale()
-self.locale = locale
+lok = locale
+if lok is None:
+import locale
+lok = locale.getdefaultlocale()
+self.locale = lok
 
 def formatweekday(self, day, width):
 with TimeEncoding(self.locale) as encoding:
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1427] Error in standard module calendar

2007-11-11 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file8736/calendar.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1427
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1427] Error in standard module calendar

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

wrong file

Added file: http://bugs.python.org/file8737/calendar_fix.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1427
__Index: Lib/calendar.py
===
--- Lib/calendar.py	(Revision 58931)
+++ Lib/calendar.py	(Arbeitskopie)
@@ -6,7 +6,9 @@
 set the first day of the week (0=Monday, 6=Sunday).
 
 from __future__ import with_statement
-import sys, datetime, locale
+import sys
+import datetime
+import locale as _locale
 
 __all__ = [IllegalMonthError, IllegalWeekdayError, setfirstweekday,
firstweekday, isleap, leapdays, weekday, monthrange,
@@ -485,11 +487,11 @@
 self.locale = locale
 
 def __enter__(self):
-self.oldlocale = locale.setlocale(locale.LC_TIME, self.locale)
-return locale.getlocale(locale.LC_TIME)[1]
+self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
+return _locale.getlocale(_locale.LC_TIME)[1]
 
 def __exit__(self, *args):
-locale.setlocale(locale.LC_TIME, self.oldlocale)
+_locale.setlocale(_locale.LC_TIME, self.oldlocale)
 
 
 class LocaleTextCalendar(TextCalendar):
@@ -503,7 +505,7 @@
 def __init__(self, firstweekday=0, locale=None):
 TextCalendar.__init__(self, firstweekday)
 if locale is None:
-locale = locale.getdefaultlocale()
+locale = _locale.getdefaultlocale()
 self.locale = locale
 
 def formatweekday(self, day, width):
@@ -537,7 +539,7 @@
 def __init__(self, firstweekday=0, locale=None):
 HTMLCalendar.__init__(self, firstweekday)
 if locale is None:
-locale = locale.getdefaultlocale()
+locale = _locale.getdefaultlocale()
 self.locale = locale
 
 def formatweekday(self, day):
@@ -658,9 +660,11 @@
 parser.error(if --locale is specified --encoding is required)
 sys.exit(1)
 
+locale = options.locale, options.encoding
+
 if options.type == html:
 if options.locale:
-cal = LocaleHTMLCalendar(locale=options.locale)
+cal = LocaleHTMLCalendar(locale=locale)
 else:
 cal = HTMLCalendar()
 encoding = options.encoding
@@ -676,7 +680,7 @@
 sys.exit(1)
 else:
 if options.locale:
-cal = LocaleTextCalendar(locale=options.locale)
+cal = LocaleTextCalendar(locale=locale)
 else:
 cal = TextCalendar()
 optdict = dict(w=options.width, l=options.lines)
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1428] Update to property.__doc__

2007-11-11 Thread Guido van Rossum

Guido van Rossum added the comment:

I would use _x instead of __x. Otherwise looks good.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1428
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1428] Update to property.__doc__

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

Applied in r58935 (trunk)

--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1428
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1427] Error in standard module calendar

2007-11-11 Thread Christian Heimes

Christian Heimes added the comment:

I've applied my patch in r58936 (trunk) and r58937 (2.5 branch).

I'm assigning the bug to Walter. Maybe he is able to shed some light on
the prweek() issue.

$ svn ann Lib/calendar.py | grep self\.week
 43483 walter.doerwald print self.week(theweek, width),

--
assignee:  - doerwalter
nosy: +doerwalter

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1427
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425] readline: no display matches hook set

2007-11-11 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Thanks for the report. This is now fixed in r58940.

--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1425
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1420] Unicode literals in tokenize.py and tests.

2007-11-11 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I think this patch is wrong. Python source code is inherently text, so
generate_tokens should decode the input, rather than operating on bytes.

--
nosy: +loewis

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1420
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1418] Python/hypot.c is never used

2007-11-11 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Thanks for the patch. Committed as r58941.

--
resolution:  - accepted
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1418
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com