[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-29 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald :

compiling pykde on windows with msvc2010 on a 32bit Windows 7:

sipdnssdpart0.cpp
R:\include\msvc\sys/types.h(52) : error C2371: 'ssize_t' : redefinition; 
different basic types
c:\python27\include\pyconfig.h(201) : see declaration of 'ssize_t'

I can fix this by defining ssize_t as long in pyconfig.h or 
as int in kdewin/include/msvc/sys/types.h

the original files from windows define SSIZE_T as long so to
me this seems like a bug in pyconfig.h, it should say
typedef _W64 long ssize_t


Python27\include\pyconfig.h says (same in Python32):

#ifdef MS_WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif

while kdewin/include/msvc/sys/types.h says:

typedef SSIZE_T ssize_t;

SSIZE_T is defined in Microsoft SDKs/Windows/v7.0A/Include/BaseTsd.h:

typedef LONG_PTR SSIZE_T, *PSSIZE_T;

and LONG_PTR from same directory, intsafe.h:
#if (__midl > 501)
typedef [public]  __int3264 LONG_PTR;
#else
#ifdef _WIN64
typedef __int64 LONG_PTR;
#else
typedef _W64 long   LONG_PTR;
#endif // WIN64
#endif // (__midl > 501)

for __midl see
http://msdn.microsoft.com/en-us/library/aa367301(v=vs.85).aspx

--
components: Windows
messages: 132558
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: conflicting definition of ssize_t in pyconfig.h
type: compile error
versions: Python 2.7

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



[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-29 Thread Wolfgang Rohdewald

Wolfgang Rohdewald  added the comment:

types.h is from kdewin/include/msvc/sys

git clone git://anongit.kde.org/kdewin

types.h uses SSIZE_T but that is nowhere defined in KDE, so it must be the 
original one from msvc

--

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



[issue11717] conflicting definition of ssize_t in pyconfig.h

2011-03-30 Thread Wolfgang Rohdewald

Changes by Wolfgang Rohdewald :


--
nosy: +mhammond

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



[issue29551] unittest: TestSuite.debug() does not like subTest()

2017-02-13 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

the main code is appended in main.py

if a test uses with self.subTest(), subTest() fails right in its first 
statement "if not self._outcome ..." because _outcome is None.

In main.py, the commented runner.run(suite) would work correctly.

If this is not meant to work, please mention it in the documentation and  
improve unittest's reaction.

what I would find more logical from the users's point of view is something like

runner.debug(suite)

--
components: Library (Lib)
files: main.py
messages: 287738
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: unittest: TestSuite.debug() does not like subTest()
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file46637/main.py

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



[issue29657] os.symlink: FileExistsError shows wrong message

2017-02-26 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

execute the attached script. It should return

FileExistsError: [Errno 17] File exists: 'a_link' -> 'a'

but it returns

FileExistsError: [Errno 17] File exists: 'a' -> 'a_link'

--
components: Library (Lib)
files: x.py
messages: 288591
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: os.symlink: FileExistsError shows wrong message
versions: Python 3.5
Added file: http://bugs.python.org/file46671/x.py

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

The documentation promises backwards compatible seeders. I understand this as 
such that they generate the same random sequences. But for Python 2.7.12 and 
3.5.2 this is not so, even if I pass an integer as seed value. The attached 
script returns different values.

Maybe I misunderstand the documentation - I believe it means that 
seed(version=1) uses the backwards compatible seeder, but it does not say so 
explicitly. If that is not so, the documentation does not say how to invoke the 
backwards compatible seeder.

--
components: Library (Lib)
files: r.py
messages: 272506
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: Random.seed(5, version=1) generates different values in PYthon2 and 
Python3
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file44082/r.py

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

There seems to be more to it, _randbelow already returns different values. 

And _randbelow is used by other user helpers like randrange, choice, select, 
shuffle, sample

--

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

@SilentGhost: Sorry, I did not see the latest messages, I was referring to 
msg272511

Having to re-implement everything but rnd.random is not very user friendly. I 
will do that now for my project.

--

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



[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface

2014-10-27 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

The attached script works with Python2.7. With Python3.4, it produces

Traceback (most recent call last):
  File "/usr/lib/python3.4/cgitb.py", line 268, in __call__
self.handle((etype, evalue, etb))
  File "cgibug.py", line 12, in handle
cgitb.Hook.handle(self, info)
  File "/usr/lib/python3.4/cgitb.py", line 273, in handle
self.file.write(reset())
TypeError: 'str' does not support the buffer interface

When replacing the file mode 'wb' with 'w', it produces this failure:
  File "/usr/lib/python3.4/cgitb.py", line 288, in handle
self.file.write(doc + '\n')
TypeError: can't concat bytes to str

The script works as expected with Python2.7 with both file modes.

--
components: Library (Lib)
files: cgibug.py
messages: 230083
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: cgitb with Py3: TypeError: 'str' does not support the buffer interface
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37043/cgibug.py

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-27 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

The attached script shows the non-ascii characters wrong wherever they occur, 
including the exception message and the comment in the source code.

Looking at the produced .html, I can say that cgitb simply passes the single 
byte utf-8 codes without encoding them as needed.

Same happens with Python3.4 (after applying some quick and dirty changes to 
cgitb.py, see bug #22745).

--
components: Library (Lib)
files: cgibug.py
messages: 230085
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: cgitb html: wrong encoding for utf-8
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file37044/cgibug.py

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-27 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

If you cannot offer a solution for arbitrary unicode, you have no solution at 
all. Afer all, that is what unicode is about: support ALL languages, not only 
your own.

I do not quite understand why you think this is not a bug.

If cgitb encodes unicode like & x e 4 ; (remove spaces), the browser does not 
have to guess the encoding, it will always show the correct character. This 
works for all of unicode. See 
https://en.wikipedia.org/wiki/Unicode_and_HTML#Numeric_character_references

So this bug is fixable, I am reopening it.

For Python3, the fix is actually very simple: Do not write doc but 
str(doc.encode('ascii', 'xmlcharrefreplace')), like in the attached patch. This 
patch works for me but there might be yet uncovered code paths. And my source 
file is encoded in utf-8, other source file encodings should be tested too. I 
do not know if cgitb correctly honors the source file header like # -*- coding: 
utf-8 -*-

Fixing this for Python2 is certainly doable too but perhaps more difficult 
because a Python2 str() may have an unknown encoding.

--
keywords: +patch
resolution: not a bug -> 
status: closed -> open
Added file: http://bugs.python.org/file37047/22746.patch

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-27 Thread Wolfgang Rohdewald

Changes by Wolfgang Rohdewald :


--
resolution:  -> remind

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



[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface

2014-10-27 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

This now works with mode 'w' and after reinstalling the packages. My Python is 
3.4.0 (ubuntu).

--
resolution:  -> not a bug
status: open -> closed

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-28 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

> What about
>  open(..., encoding='latin-1', errors='xmlcharrefreplace')

That works fine. I tested with a chinese character 与

But I do not think the application should work around something that cgitb is 
supposed to handle. More so since the documentation is dead silent about this. 
You need to use codecs.open instead of open and add those kw arguments. As long 
as this is not explained in the documentation, I guess it is a bug for everyone 
not using latin-1.

--

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-28 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

correction: A bug for everyone using non-ascii characters.

--

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-28 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

> > You need to use codecs.open instead of open
> No, why? in python3 open() supports the errors handler.

right, but not in python2 which has the same problem. I need my code to run 
with both.

> Do you have a use case for xmlcharrefreplace in the HTML context?

No, my only use case is the local file.

--

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