[issue16192] ctypes - documentation example

2016-06-02 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue16192] ctypes - documentation example

2016-06-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dfde53cf07e6 by Berker Peksag in branch '3.5':
Issue #16192: Fix copy and paste mistake noticed by Eryk Sun
https://hg.python.org/cpython/rev/dfde53cf07e6

New changeset 7f3ebd86464b by Berker Peksag in branch 'default':
Issue #16192: Merge from 3.5
https://hg.python.org/cpython/rev/7f3ebd86464b

--

___
Python tracker 

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



[issue16192] ctypes - documentation example

2016-06-02 Thread Eryk Sun

Eryk Sun added the comment:

> ``sizeof(long double) == sizeof(double)`` it is an alias to
> :class:`c_double`.  

This should be "``sizeof(long) == sizeof(int)`` ... :class:`c_long`".

--
resolution: fixed -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue16192] ctypes - documentation example

2016-06-02 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue16192] ctypes - documentation example

2016-06-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1775abf47061 by Berker Peksag in branch '3.5':
Issue #16192: Clarify when c_int is an alias to c_long in ctypes documentation
https://hg.python.org/cpython/rev/1775abf47061

New changeset 9954e29b8678 by Berker Peksag in branch 'default':
Issue #16192: Merge from 3.5
https://hg.python.org/cpython/rev/9954e29b8678

--
nosy: +python-dev

___
Python tracker 

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



[issue16192] ctypes - documentation example

2015-01-09 Thread Berker Peksag

Berker Peksag added the comment:

 It's not correct that [The c_int] type is an alias for the c_long type on 
 32-bit systems. Actually it's an alias if int and long are the same size.

It's already documented at 
https://docs.python.org/dev/library/ctypes.html#ctypes.c_int

On platforms where sizeof(int) == sizeof(long) it is an alias to c_long.

Do you want to write a patch to update the original note?

--
nosy: +berker.peksag
stage:  - needs patch
status: closed - open
versions: +Python 3.5

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



[issue16192] ctypes - documentation example

2015-01-09 Thread eryksun

eryksun added the comment:

It's not correct that [The c_int] type is an alias for the c_long type on 
32-bit systems. Actually it's an alias if int and long are the same size. 
Here's the relevant snippet from __init__:

if _calcsize(i) == _calcsize(l):
# if int and long have the same size, make c_int an alias for c_long
c_int = c_long
c_uint = c_ulong
else:
class c_int(_SimpleCData):
_type_ = i
_check_size(c_int)

class c_uint(_SimpleCData):
_type_ = I
_check_size(c_uint)

Notably, int and long are the same size on 64-bit Windows:

 sizeof(c_void_p) # 64-bit
8
 c_int
class 'ctypes.c_long'
 sizeof(c_long)   
4

--
nosy: +eryksun

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



[issue16192] ctypes - documentation example

2015-01-08 Thread Brian Thorne

Changes by Brian Thorne hardb...@gmail.com:


--
nosy:  -Thorney, chris.jerdonek, eric.araujo, ezio.melotti, georg.brandl
status: open - closed

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



[issue16192] ctypes - documentation example

2012-10-12 Thread Ezio Melotti

Ezio Melotti added the comment:

The note at the beginning could be turned in an actual note using the `.. 
note:` markup.  This will make it more visible.

--

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



[issue16192] ctypes - documentation example

2012-10-11 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 Perhaps if some machines expect otherwise that should be documented, 
 otherwise might we change them.

The very beginning of the ctypes documentation has documentation to that effect:

Note: Some code samples reference the ctypes c_int type. This type is an alias 
for the c_long type on 32-bit systems. So, you should not be confused if c_long 
is printed if you would expect c_int — they are actually the same type.

http://docs.python.org/dev/library/ctypes.html#ctypes-tutorial

Does that address your suggestion?

--
nosy: +chris.jerdonek
status: open - pending

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



[issue16192] ctypes - documentation example

2012-10-11 Thread Brian Thorne

Brian Thorne added the comment:

 The very beginning of the ctypes documentation has documentation to that 
 effect

Does that address your suggestion?

Thanks Chris, that explains why the difference is present on non 32 bit 
platforms. Would using c_long for the examples produce the expected output on 
64 and 32 bit systems? 

Just an idea to try remove potential confusion.

--
status: pending - open
Added file: http://bugs.python.org/file27525/ctypes_doc.diff

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



[issue16192] ctypes - documentation example

2012-10-11 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I don't know off-hand.  But maybe an additional note or code comment at the 
first instance in a code example would help.  Switching the examples to c_long 
might serve only to shift potential confusion from the examples to someone's 
personal machine.

--

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



[issue16192] ctypes - documentation example

2012-10-10 Thread Brian Thorne

New submission from Brian Thorne:

The Python docs for ctypes have embedded examples including:

 c_int()
c_long(0)

But on my machine I get the (more expected?):

 c_int()
c_int(0)

Perhaps if some machines expect otherwise that should be documented, otherwise 
might we change them.

--
components: ctypes
files: ctypes_doc.diff
keywords: patch
messages: 172616
nosy: Thorney, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: ctypes - documentation example
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file27523/ctypes_doc.diff

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