Commit Graph

13 Commits

Author SHA1 Message Date
William S Fulton 36bb54f01d Convert swigobject python test to be python 2 and 3 compatible 2020-08-14 23:27:35 +01:00
William S Fulton 365d4961d4 Remove print statements from Python tests
Use exceptions instead of printing to stdout.
Part of an effort to convert Python tests to python 3 syntax.
2020-08-13 21:22:47 +01:00
Dmitry D. Chernov fa5f519bf9 Test-suite: Unify string quoting in the Python sources 2019-07-14 12:58:21 +10:00
Jon Schlueter b77f3afafb autopep8 cleanup of Examples/test-suite/python
automated cleanup of python pep8 whitespace compliance
2015-05-08 21:35:52 -04:00
Haoyu Bai caa6f2b9fa Fixes to support Python 3.0.1 and higher.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11143 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-02 17:56:29 +00:00
William S Fulton ecdd24a508 yet better pointer string comparison
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11056 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-11 21:37:54 +00:00
William S Fulton 3d8f569466 another portability fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11055 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-11 21:32:42 +00:00
William S Fulton cca31dde4f more portable pointer in a string comparison
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11054 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-11 17:57:21 +00:00
William S Fulton ed0ae261bf fix cast of pointer to long
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11042 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-08 19:35:13 +00:00
Marcelo Matus 19613c8909 fix hex pointer conversion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7022 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-03-02 17:55:13 +00:00
Marcelo Matus 32d5addaa6 fix hex pointer conversion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7021 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-03-02 17:52:34 +00:00
Marcelo Matus 25e1e7932a adding more cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6814 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-01 01:17:56 +00:00
Marcelo Matus 0881d3c861 Add simple PySwigObject to handle the C/C++ instance pointers,
instead of using PyCObject or plain strings.

The new PySwigObject is even safer than PyCObject, and
more friendly than plain strings:

now you can do

  print a.this
  <Swig Object at _00691608_p_A>

  print str(a.this)
  _00691608_p_A

  print long(a.this)
  135686400

  print "%s 0x%x" % (a.this, a.this)
  _00691608_p_A 0x8166900


the last one is very useful when debugging the C/C++ side, since
is the pointer value you will usually get from the debugger.

Also, if you have some old code that uses the string representation
"_00691608_p_A", you can use it now again by calling str(ptr), or
maybe nothing special by just calling PyString_AsString(..).

This change is mainly for nostalgic swig users that miss the
string representation, but also allows to say again

  if a.this == b.this:
    return "a is b"

and well, since the change were really simple, maybe in the future
we will be able to do

    next = a.this + 1

or add native python iteration over native C/C++ arrays, ie, no
need to create/copy new tuples when returning and array or vector.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-11-19 20:40:20 +00:00