Commit 2c44cabe authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.7.6

parent 869f20f9
......@@ -4,21 +4,19 @@ for %%I in ( %0\..\.. ) do set WORKDIR=%%~fI
set PY_MAJ=2
if not "%1" == "" set PY_MAJ=%1
set PY_MIN=6
set PY_MIN=7
if not "%2" == "" set PY_MIN=%2
if not "%3" == "" set BUILD_TYPE=%3
if not "%4" == "" set SVN_VER_MAJ_MIN=%4
if "%BUILD_TYPE%" == "" set /p BUILD_TYPE="Build type (Release): "
if "%BUILD_TYPE%" == "" set BUILD_TYPE=Release
if "%SVN_VER_MAJ_MIN%" == "" set /p SVN_VER_MAJ_MIN="Build Version (1.6): "
if "%SVN_VER_MAJ_MIN%" == "" set SVN_VER_MAJ_MIN=1.6
if "%SVN_VER_MAJ_MIN%" == "" set /p SVN_VER_MAJ_MIN="Build Version (1.7): "
if "%SVN_VER_MAJ_MIN%" == "" set SVN_VER_MAJ_MIN=1.7
if "%SVN_VER_MAJ_MIN%" == "1.4" set SVN_VER_MAJ_DASH_MIN=1-4
if "%SVN_VER_MAJ_MIN%" == "1.5" set SVN_VER_MAJ_DASH_MIN=1-5
if "%SVN_VER_MAJ_MIN%" == "1.6" set SVN_VER_MAJ_DASH_MIN=1-6
if "%SVN_VER_MAJ_MIN%" == "1.7" set SVN_VER_MAJ_DASH_MIN=1-7
rem Save CWD
......@@ -32,6 +30,7 @@ if "%PY_MAJ%.%PY_MIN%" == "2.6" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "2.7" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "3.0" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "3.1" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "3.2" set COMPILER=msvc90
if exist ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions-%SVN_VER_MAJ_MIN%.cmd (
pushd ..\..\ReleaseEngineering\win32-%COMPILER%
......@@ -39,26 +38,19 @@ if exist ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions-%SVN_VER_MA
popd
)
if "%PY_MAJ%" == "2" set PYCXX_VER=%PY2CXX_VER%
if "%PY_MAJ%" == "3" set PYCXX_VER=%PY3CXX_VER%
set PYCXX=%WORKDIR%\Import\pycxx-%PYCXX_VER%
set OPENSSL=%TARGET%\openssl-%OPENSSL_VER%
set SUBVERSION=%TARGET%\subversion-%SVN_VER%
set APR=%SUBVERSION%
set PY=c:\python%PY_MAJ%%PY_MIN%
set PYLIB=python%PY_MAJ%%PY_MIN%
set PY=c:\python%PY_MAJ%%PY_MIN%.win32
if not exist %PY%\python.exe set PY=c:\python%PY_MAJ%%PY_MIN%
set PYTHONPATH=%WORKDIR%\Source
set PYTHON=%PY%\python.exe
set PYSVNMODULE=_pysvn_%PY_MAJ%_%PY_MIN%.pyd
if "%PY_MAJ%" == "2" set PYSVN_INIT_FUNCTION=init_pysvn
if "%PY_MAJ%" == "3" set PYSVN_INIT_FUNCTION=PyInit__pysvn
rem Need python and SVN on the path
PATH %PY%;%SUBVERSION%\%BUILD_TYPE%\bin;%PATH%
PATH %PY%;%SVN_BIN%;%PATH%
rem prove the python version selected
python -c "import sys;print( 'Info: Python Version %%s' %% sys.version )"
svn --version
rem restore original CWD
popd
......@@ -8,7 +8,7 @@ else
PREF_VER=2.7
fi
for PY_VER in ${PREF_VER} 2.7 2.6 2.5 2.4 2.3 2.2
for PY_VER in ${PREF_VER} 2.7 2.6
do
# used in pick python to use in Builder driver makefile
export PYTHON=$( which python${PY_VER} )
......
......@@ -9,7 +9,7 @@ clean: ../Source/Makefile
rm -rf ../Kit/Linux/tmp
../Source/Makefile: ../Source/setup.py
cd ../Source && $(PYTHON) setup.py configure $(CONFIG_ARGS)
cd ../Source && $(PYTHON) setup.py configure --platform=linux $(CONFIG_ARGS)
kit:
......
MAJOR=1
MINOR=7
PATCH=5
PATCH=6
BUILD=0
BUILD_TYPE=Release
SVN_VER_MAJ_MIN=1.6
SVN_VER_MAJ_MIN=1.7
VCBUILD_OPT=/useenv /nologo /nocolor "/info:Info: " "/error:Error: " "/warning:Warn: "
build: all test kit
all:
cd ..\Source & vcbuild /rebuild $(VCBUILD_OPT) pysvn-for-svn-$(SVN_VER_MAJ_DASH_MIN)-msvc90.sln "Release|Win32"
cd ..\Source & $(PYTHON) setup.py configure vcbuild /rebuild $(VCBUILD_OPT) pysvn-for-svn-$(SVN_VER_MAJ_DASH_MIN)-msvc90.sln "Release|Win32"
clean:
......
......@@ -31,11 +31,15 @@ span.svn_example {display: inline; }
</style>
<style id="show_style" type="text/css">
span.svn_1007000 {display: inline; }
span.svn_1006000 {display: inline; }
span.svn_1005000 {display: inline; }
span.svn_1004000 {display: inline; }
span.svn_1003000 {display: inline; }
span.svn_1002000 {display: inline; }
span.svn_1001000 {display: inline; }
div.svn_1007000 {display: block; }
div.svn_1006000 {display: block; }
div.svn_1005000 {display: block; }
div.svn_1004000 {display: block; }
div.svn_1003000 {display: block; }
......@@ -65,6 +69,7 @@ only available with SVN 1.6.0 or later.
<p>Click one of the buttons below to show the pysvn API as supported
by a particular version of the SVN.</p>
<div id="buttons_work" style="display: none">
<span class="button" onclick='changeDisplay( 1007000 )'>Show SVN 1.7.0 API</span>
<span class="button" onclick='changeDisplay( 1006000 )'>Show SVN 1.6.0 API</span>
<span class="button" onclick='changeDisplay( 1005000 )'>Show SVN 1.5.0 API</span>
<span class="button" onclick='changeDisplay( 1004000 )'>Show SVN 1.4.0 API</span>
......@@ -217,6 +222,8 @@ and credential handling.
</p>
<p><a href="#pysvn_client_callback_ssl_server_trust_prompt">callback_ssl_server_trust_prompt</a> is called when using HTTPS to a server whoes certificate needs is trust verifing.
</p>
<p><a href="#pysvn_client_callback_conflict_resolver">callback_conflict_resolver</a> is called to handle conflicts.
</p>
<p>It is possible to use the Client object without setting up any
calls backs. Make sure that all nessesary usernames, passwords and
SSL certificate information are stored in the subversion
......@@ -431,6 +438,50 @@ a tuple of three values (retcode, accepted_failures, save).
to prevent saving the certificate.</li>
</ul>
<h4><a name="pysvn_client_callback_conflict_resolver"><a href="#pysvn_module">pysvn</a>.<a href="#pysvn_client">Client</a>.callback_conflict_resolver</a></h4>
<pre>
import pysvn
def conflict_resolver( conflict_description ):
return conflict_choice, merge_file, save_merged
client = pysvn.Client()
client.callback_conflict_resolver = conflict_resolver
</pre>
<p>The callback_conflict_resolver is called each time a conflict needs resolving.
It is passed the conflict_description and must return a conflict_choice, merge_file and save_merged.
</p>
<p>The members of the conflict_description dictionary are:</p>
<ul>
<li>path - string - The path that is in conflict (for a tree conflict, it is the victim)</li>
<li>node_kind - pysvn.node_kind - The node type of the path being operated on</li>
<li>kind - pysvn.conflict_kind - the sort of conflict being described</li>
<li>property_name - string or None - The name of the property whose conflict is being described.
(Only if kind is 'property'; else undefined.)</li>
<li>is_binary - boolean - Whether svn thinks ('my' version of) path is a 'binary' file.
(Only if kind is 'text', else undefined.)</li>
<li>mime_type - string or None - The svn:mime-type property of ('my' version of) path</li>
<li>action - pysvn.wc_conflict_action - the action being attempted on the conflicted node or property</li>
<li>reason - pysvn.wc_conflict_reason - The state of the target node or property, relative to its merge-left
source, that is the reason for the conflict</li>
<li>base_file - string - common ancestor of the two files being merged</li>
<li>their_file - string - their version of the file</li>
<li>my_file - string - my locally-edited version of the file</li>
<li>merged_file - string - merged version; may contain conflict markers</li>
<li>operation - pysvn.wc_operation - the operation that exposed the conflict. Used only for tree conflicts</li>
<li>src_left_version - pysvn.wc_conflict_version - Info on the "merge-left source" or "older" version of incoming change</li>
<li>src_right_version - pysvn.wc_conflict_version - Info on the "merge-right source" or "their" version of incoming change</li>
</ul>
<ul>
<li>conflict_choice is one of the pysvn.wc_conflict_choice values</li>
<li>merge_file is a file name or None</li>
<li>save_merged is True or False</li>
</ul>
<h3><a name="pysvn_client_methods">Client methods</a></h3>
<table border="0" cellspacing="0" cellpadding="5">
......@@ -518,7 +569,7 @@ a tuple of three values (retcode, accepted_failures, save).
<td><a href="#pysvn_client_switch">switch</a></td>
<td><span class="svn_1002000"><a href="#pysvn_client_unlock">unlock</a></span></td>
<td><a href="#pysvn_client_update">update</a></td>
<td>&nbsp;</td>
<td><span class="svn_1007000"><a href="#pysvn_client_upgrade">upgrade</a></span></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
......@@ -2050,6 +2101,15 @@ current revision. To make the current version identical to
an older revision, use a merge followed by a commit.
</p>
<div class="svn_1007000">
<h4><a name="pysvn_client_upgrade"><a href="#pysvn_module">pysvn</a>.<a href="#pysvn_client">Client</a>.upgrade</a></h4>
<pre>
upgrade( path )
</pre>
<p>Recursively upgrade a working copy from any older format to the current
WC metadata storage format. path is the path to the WC root.
</p>
</div>
<h2><a name="pysvn_transaction"><a href="#pysvn_module">pysvn</a>.Transaction - Subversion transaction interface</a></h2>
......@@ -2367,8 +2427,8 @@ except pysvn.ClientError, e:
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_opt_revision_kind">opt_revision_kind - subversion
revision number kind enumeration</a></h2>
name="pysvn_opt_revision_kind">opt_revision_kind - subversion
revision number kind enumeration</a></h2>
<ul>
<li>unspecified - No revision information given.</li>
<li>number - revision given as number</li>
......@@ -2381,8 +2441,8 @@ except pysvn.ClientError, e:
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_wc_notify_action">wc_notify_action - subversion
notification callback action enumeration</a></h2>
name="pysvn_wc_notify_action">wc_notify_action - subversion
notification callback action enumeration</a></h2>
<ul>
<li>add - Adding a path to revision control.</li>
<li>copy - Copying a versioned path.</li>
......@@ -2412,8 +2472,8 @@ except pysvn.ClientError, e:
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_wc_status_kind">wc_status_kind - subversion
status kind enumeration</a></h2>
name="pysvn_wc_status_kind">wc_status_kind - subversion
status kind enumeration</a></h2>
<ul>
<li>none - does not exist</li>
<li>unversioned - is not a versioned thing in this wc</li>
......@@ -2432,8 +2492,8 @@ except pysvn.ClientError, e:
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_wc_merge_outcome">wc_merge_outcome - subversion
merge outcome enumeration</a></h2>
name="pysvn_wc_merge_outcome">wc_merge_outcome - subversion
merge outcome enumeration</a></h2>
<ul>
<li>unchanged - The working copy is (or would be) unchanged.
The changes to be merged were already present in the working copy</li>
......@@ -2445,8 +2505,8 @@ file was either absent or not under version control.</li>
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_wc_notify_state">wc_notify_state - subversion
notify callback state enumeration</a></h2>
name="pysvn_wc_notify_state">wc_notify_state - subversion
notify callback state enumeration</a></h2>
<ul>
<li>inapplicable - inapplicable</li>
<li>unknown - Notifier doesn't know or isn't saying.</li>
......@@ -2459,7 +2519,7 @@ file was either absent or not under version control.</li>
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_wc_schedule">wc_schedule - subversion status schedule enumeration</a></h2>
name="pysvn_wc_schedule">wc_schedule - subversion status schedule enumeration</a></h2>
<ul>
<li>normal - Nothing special here</li>
<li>add - Slated for addition</li>
......@@ -2468,7 +2528,7 @@ file was either absent or not under version control.</li>
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_node_kind">node_kind - subversion node kind enumeration</a></h2>
name="pysvn_node_kind">node_kind - subversion node kind enumeration</a></h2>
<ul>
<li>none - absent</li>
<li>file - regular file</li>
......@@ -2477,7 +2537,7 @@ file was either absent or not under version control.</li>
</ul>
<h2><a href="#pysvn_module">pysvn</a>.<a
name="pysvn_depth">depth - subversion depth enumeration</a></h2>
name="pysvn_depth">depth - subversion depth enumeration</a></h2>
<ul>
<li>empty - Just the named directory D, no entries. Updates will not pull in
any files or subdirectories not already present.</li>
......
This diff is collapsed.
......@@ -14,6 +14,7 @@ import os
import parse_datetime
import glob
import locale
import types
try:
sorted( [] )
......@@ -23,6 +24,11 @@ except NameError:
list_out.sort()
return list_out
if hasattr( types, 'StringTypes' ):
StringTypes = types.StringTypes
else:
StringTypes = [type( '' )]
class CommandError( Exception ):
def __init__( self, reason ):
Exception.__init__( self )
......@@ -145,6 +151,32 @@ if hasattr( pysvn.wc_notify_action, 'property_added' ):
wc_notify_action_map[ pysvn.wc_notify_action.tree_conflict ] = 'tree_conflict'
wc_notify_action_map[ pysvn.wc_notify_action.failed_external ] = 'failed_external'
if hasattr( pysvn.wc_notify_action, 'update_started' ):
wc_notify_action_map[ pysvn.wc_notify_action.update_started ] = 'update_started'
wc_notify_action_map[ pysvn.wc_notify_action.update_skip_obstruction ] = 'update_skip_obstruction'
wc_notify_action_map[ pysvn.wc_notify_action.update_skip_working_only ] = 'update_skip_working_only'
wc_notify_action_map[ pysvn.wc_notify_action.update_external_removed ] = 'update_external_removed'
wc_notify_action_map[ pysvn.wc_notify_action.update_shadowed_add ] = 'update_shadowed_add'
wc_notify_action_map[ pysvn.wc_notify_action.update_shadowed_update ] = 'update_shadowed_update'
wc_notify_action_map[ pysvn.wc_notify_action.update_shadowed_delete ] = 'update_shadowed_delete'
wc_notify_action_map[ pysvn.wc_notify_action.merge_record_info ] = 'merge_record_info'
wc_notify_action_map[ pysvn.wc_notify_action.upgraded_path ] = 'upgraded_path'
wc_notify_action_map[ pysvn.wc_notify_action.merge_record_info_begin ] = 'merge_record_info_begin'
wc_notify_action_map[ pysvn.wc_notify_action.merge_elide_info ] = 'merge_elide_info'
wc_notify_action_map[ pysvn.wc_notify_action.patch ] = 'patch'
wc_notify_action_map[ pysvn.wc_notify_action.patch_applied_hunk ] = 'patch_applied_hunk'
wc_notify_action_map[ pysvn.wc_notify_action.patch_rejected_hunk ] = 'patch_rejected_hunk'
wc_notify_action_map[ pysvn.wc_notify_action.patch_hunk_already_applied ] = 'patch_hunk_already_applied'
wc_notify_action_map[ pysvn.wc_notify_action.commit_copied ] = 'commit_copied'
wc_notify_action_map[ pysvn.wc_notify_action.commit_copied_replaced ] = 'commit_copied_replaced'
wc_notify_action_map[ pysvn.wc_notify_action.url_redirect ] = 'url_redirect'
wc_notify_action_map[ pysvn.wc_notify_action.path_nonexistent ] = 'path_nonexistent'
wc_notify_action_map[ pysvn.wc_notify_action.exclude ] = 'exclude'
wc_notify_action_map[ pysvn.wc_notify_action.failed_conflict ] = 'failed_conflict'
wc_notify_action_map[ pysvn.wc_notify_action.failed_missing ] = 'failed_missing'
wc_notify_action_map[ pysvn.wc_notify_action.failed_out_of_date ] = 'failed_out_of_date'
wc_notify_action_map[ pysvn.wc_notify_action.failed_no_parent ] = 'failed_no_parent'
class SvnCommand:
def __init__( self, progname ):
self.progname = progname
......@@ -213,7 +245,10 @@ class SvnCommand:
def callback_conflict_resolver( self, arg_dict ):
print( 'callback_conflict_resolver' )
for key in sorted( arg_dict.keys() ):
print( ' %s: %r' % (key, arg_dict[ key ]) )
value = arg_dict[ key ]
if type(value) not in StringTypes:
value = repr(value)
print( ' %s: %s' % (key, value) )
return pysvn.wc_conflict_choice.postpone, None, False
......@@ -437,7 +472,7 @@ class SvnCommand:
positional_args.append( '.' )
path = positional_args[0]
entry = self.client.info( path )
print( 'Path: %s' % path )
......@@ -945,6 +980,7 @@ class SvnCommand:
positional_args = args.getPositionalArgs( 0 )
if len(positional_args) == 0:
positional_args.append( '.' )
rev_list = self.client.update( positional_args[0], recurse=recurse )
self.printNotifyMessages()
if type(rev_list) == type([]) and len(rev_list) != 1:
......
......@@ -17,39 +17,48 @@ code {background-color: #dddddd; }
<p>To build pysvn you will require:</p>
<ul>
<li><a href="http://www.python.org">Python</a> 2.2 or later with these options:
<li><a href="http://www.python.org">Python</a> 2.6 or later with these options:
<ul>
<li>Python runtime package
<li>Python development package
<li>Python pyexpat package
</ul>
</li>
<li><a href="http://subversion.tigris.org">subversion</a> 1.5.x or 1.6.x with these options:
<li><a href="http://subversion.tigris.org">subversion</a> 1.6.x or 1.7.x with these options:
<ul>
<li>Subversion client package
<li>Subversion development package
</ul>
</li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=3180">PyCXX V6.2.2</a> to build against Python 2 or Python 3 which is included in the pysvn source kit.</li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=3180">PyCXX V6.2.4</a> to build against Python 2 or Python 3 which is included in the pysvn source kit.</li>
</ul>
<p>Some distributions will split python and subversion into more the one package.</p>
<p>You will need to find all the packages that give you the options listed above.</p>
<h3>Building on win32</h3>
<p>These instructions assume you have Microsoft Visual C++ 6.0 to compile the code
and <a href="http://www.jrsoftware.org/">INNO</a> 4.0.10 to create the installation kit.</p>
<p>Note: You must build with MSVC 6.0 as python 2.3 and earlier was built with that version.</p>
<p>Note: You must build with MSVC 2003.NET for python 2.4 or Python 2.5.</p>
<p>Note: You must build with MSVC 2008 (9.0) for Python 2.6 or later and python 3.0 or later.</p>
<p>PYSVN sources have been updated to build on Windows 7 64bit version.
Expect issues on older windows and 32but windows.</p>
<p>These instructions assume you have Microsoft Visual C++ 2008 (9.0) to compile the code
and <a href="http://www.jrsoftware.org/">INNO</a> 5 to create the installation kit.</p>
<p>You must build with MSVC 2008 (9.0) for Python 2.6 or later and python 3.0 or later.</p>
<ol>
<li>Build subversion (tested with SVN 1.5.6 and svn 1.6.15)</li>
<li>Build subversion (tested with and svn 1.7.1)</li>
<li>Fetch and expand the pysvn source code into <em>extdir</em></li>
<li>Expand pycxx-6.2.1.tar.gz into <em>extdir</em>\Import if not using a source kit</li>
<li>Expand pycxx-6.2.4.tar.gz into <em>extdir</em>\Import if not using a source kit</li>
<li>Edit Builder\builder_custom_init.cmd to match the locations of the sources.</li>
<li><code>cd Builder</code></li>
<li><code>builder_custom_init.cmd</code></li>
<li><code>nmake -f win32.mak build</code></li>
<li><code>cd ..\Source</code>
<li><code>python setup.py configure ...</code> (add any configure options required to make it find the required libraries).</li>
<li><code>nmake</code></li>
<li><code>cd ..\Test</code></li>
<li><code>nmake</code></li>
<li><code>cd ..\Kit\Win32-1.7</code></li>
<li><code>nmake</code></li>
</ol>
<p>To install the built kit</p>
......@@ -65,9 +74,9 @@ and <a href="http://www.jrsoftware.org/">INNO</a> 4.0.10 to create the installat
<li>Install subversion.
<br />When installing from packages you will need to install the <i>devel</i> packages as well. For example on Fedora/Redhat subversion-devel, apr-devel, apr-util-devel and their dependancies.</li>
<li>Get the pysvn source code</li>
<li>For Python 2 or Python 3 builds: <code>tar xzf pycxx-6.2.1.tar.gz</code> into <em>extdir</em>/Import if not using a source kit</li>
<li>For Python 2 or Python 3 builds: <code>tar xzf pycxx-6.2.4.tar.gz</code> into <em>extdir</em>/Import if not using a source kit</li>
<li><code>cd Source</code></li>
<li>For Python 2 builds: backport the PySVN code using <code>python setup.py backport</code></li>
<li>For Python 2.6 or earlier builds: backport the PySVN code using <code>python setup.py backport</code></li>
<li>Create the Makefile using <code>python setup.py configure</code></li>
<li><code>make</code></li>
<li><code>cd Tests</code></li>
......
//-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Src/Python2/IndirectPythonInterface.cxx"
#else
#include "Src/Python3/IndirectPythonInterface.cxx"
#endif
......@@ -66,9 +66,6 @@ namespace Py
const std::string m_module_name;
const std::string m_full_module_name;
MethodTable m_method_table;
#if PY3
PyModuleDef m_module_def;
#endif
PyObject *m_module;
private:
......@@ -139,8 +136,8 @@ namespace Py
static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc );
Tuple args( 2 );
args[0] = Object( self );
args[1] = Object( PyCObject_FromVoidPtr( method_def, do_not_dealloc ) );
args[0] = Object( self, true );
args[1] = Object( PyCObject_FromVoidPtr( method_def, do_not_dealloc ), true );
PyObject *func = PyCFunction_New
(
......
......@@ -178,7 +178,7 @@ namespace Py
Tuple self( 2 );
self[0] = Object( this );
self[1] = Object( PyCObject_FromVoidPtr( method_def, do_not_dealloc ) );
self[1] = Object( PyCObject_FromVoidPtr( method_def, do_not_dealloc ), true );
PyObject *func = PyCFunction_New( &method_def->ext_meth_def, self.ptr() );
......@@ -235,10 +235,8 @@ namespace Py
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
T *self = static_cast<T *>( self_in_cobject );
MethodDefExt<T> *meth_def = reinterpret_cast<MethodDefExt<T> *>(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() ) );
Object result;
// Adding try & catch in case of STL debug-mode exceptions.
......@@ -272,9 +270,9 @@ namespace Py
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
T *self = static_cast<T *>( self_in_cobject );
MethodDefExt<T> *meth_def = reinterpret_cast<MethodDefExt<T> *>(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() ) );
Tuple args( _args );
Object result;
......@@ -309,6 +307,7 @@ namespace Py
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
T *self = static_cast<T *>( self_in_cobject );
MethodDefExt<T> *meth_def = reinterpret_cast<MethodDefExt<T> *>(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() ) );
......
......@@ -70,9 +70,7 @@ namespace Py
virtual void reinit( Tuple &args, Dict &kwds );
// object basics
#if defined( PYCXX_PYTHON_2TO3 ) || !defined( PY3 )
virtual int print( FILE *, int );
#endif
virtual Object getattr( const char * );
virtual int setattr( const char *, const Object & );
virtual Object getattro( const String & );
......
......@@ -2059,7 +2059,7 @@ namespace Py
String decode( const char *encoding, const char *error="strict" )
{
return Object( PyString_AsDecodedObject( ptr(), encoding, error ) );
return Object( PyString_AsDecodedObject( ptr(), encoding, error ), true );
}
// Queries
......@@ -2208,17 +2208,17 @@ namespace Py
{
if( isUnicode() )
{
return String( PyUnicode_AsEncodedString( ptr(), encoding, error ) );
return String( PyUnicode_AsEncodedString( ptr(), encoding, error ), true );
}
else
{
return String( PyString_AsEncodedObject( ptr(), encoding, error ) );
return String( PyString_AsEncodedObject( ptr(), encoding, error ), true );
}
}
String decode( const char *encoding, const char *error="strict" )
{
return Object( PyString_AsDecodedObject( ptr(), encoding, error ) );
return Object( PyString_AsDecodedObject( ptr(), encoding, error ), true );
}
// Queries
......
......@@ -57,17 +57,15 @@ namespace Py
PythonType &doc( const char *d );
PythonType &supportClass( void );
#if !defined( PY3 )
PythonType &dealloc( void (*f)( PyObject* ) );
#endif
#if defined( PYCXX_PYTHON_2TO3 ) || !defined( PY3 )
#if defined( PYCXX_PYTHON_2TO3 )
PythonType &supportPrint( void );
#endif
PythonType &supportGetattr( void );
PythonType &supportSetattr( void );
PythonType &supportGetattro( void );
PythonType &supportSetattro( void );
#if defined( PYCXX_PYTHON_2TO3 ) || !defined( PY3 )
#if defined( PYCXX_PYTHON_2TO3 )
PythonType &supportCompare( void );
#endif
PythonType &supportRichCompare( void );
......
......@@ -107,4 +107,11 @@
# define TEMPLATE_TYPENAME class
#endif
// before 3.2 Py_hash_t was missing
#ifndef PY_MAJOR_VERSION
#error not defined PY_MAJOR_VERSION
#endif
#if PY_MINOR_VERSION < 2
typedef long int Py_hash_t;
#endif
#endif // __PyCXX_config_hh__
......@@ -82,8 +82,6 @@ namespace Py
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" void do_not_dealloc( void * );