Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python 3.5 #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- 2.7
- 3.2
- 3.4
- 3.5
before_install:
- sudo apt-get install software-properties-common
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
Expand Down
50 changes: 31 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
version: 2.1.{build}

os: Windows Server 2012

environment:
global:
PYTHONPATH: c:\testdir
PYTHONWARNINGS: 'ignore:::pip.pep425tags:'
PIPURL: https://bootstrap.pypa.io/get-pip.py

matrix:
- pythonurl: http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi
- pythonurl: http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
- pythonurl: http://www.python.org/ftp/python/3.3.5/python-3.3.5.msi
- pythonurl: http://www.python.org/ftp/python/3.3.5/python-3.3.5.amd64.msi
- pythonurl: http://www.python.org/ftp/python/3.4.2/python-3.4.2.msi
- pythonurl: http://www.python.org/ftp/python/3.4.2/python-3.4.2.amd64.msi

# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python
# The list here is complete (excluding Python 2.6, which
# isn't covered by this document) at the time of writing.

- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python33"
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python33-x64"
DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python34-x64"
DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python35-x64"

install:
- ps: (new-object net.webclient).DownloadFile($env:pythonurl, 'C:\python.msi')
- ps: start-process -wait -FilePath msiexec.exe -ArgumentList '/qn /x C:\python.msi TARGETDIR=C:\Python'
- ps: start-process -wait -FilePath msiexec.exe -ArgumentList '/qn /i C:\python.msi TARGETDIR=C:\Python'
- ps: (new-object net.webclient).DownloadFile($env:PIPURL, 'C:\get-pip.py')
- C:\Python\python.exe --version
- C:\Python\python.exe c:\get-pip.py
- C:\Python\Scripts\pip.exe install wheel
- C:\Python\Scripts\pip.exe install six
# We need wheel installed to build wheels
- "%PYTHON%\\python.exe -m pip install --upgrade pip"
- "%PYTHON%\\python.exe -m pip install wheel"
- "%PYTHON%\\python.exe -m pip install six"

build_script:
- C:\python\python.exe setup.py bdist_wheel
- "%PYTHON%\\python.exe setup.py bdist_wheel"

test_script:
- ps: C:\Python\Scripts\pip.exe install --no-cache-dir --force-reinstall --ignore-installed ('dist\' + (gci dist)[0].Name)
- cd "%PYTHON%"
- ps: Scripts\pip.exe install --no-cache-dir --force-reinstall --ignore-installed ('C:\\projects\\pythonnet\\dist\\' + (gci C:\projects\pythonnet\dist)[0].Name)
- cd C:\projects\pythonnet
- mkdir c:\testdir
- ps: copy-item (gci -path build -re -include Python.Test.dll)[0].FullName c:\testdir
- c:\python\python.exe src\tests\runtests.py
- "%PYTHON%\\python.exe src\\tests\\runtests.py"

artifacts:
# bdist_wheel puts your built wheel in the dist directory
- path: dist\*
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def _check_output(*popenargs, **kwargs):
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: C#',
'License :: OSI Approved :: Zope Public License',
'Development Status :: 5 - Production/Stable',
Expand Down
6 changes: 3 additions & 3 deletions src/clrmodule/ClrModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class clrModule
// ReSharper restore CheckNamespace
{
// ReSharper disable InconsistentNaming
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
[RGiesecke.DllExport.DllExport("PyInit_clr", System.Runtime.InteropServices.CallingConvention.StdCall)]
public static IntPtr PyInit_clr()
#else
Expand Down Expand Up @@ -107,7 +107,7 @@ public static void initclr()
#if DEBUG_PRINT
System.Console.WriteLine("Could not load Python.Runtime, so sad.");
#endif
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
return IntPtr.Zero;
#else
return;
Expand All @@ -119,7 +119,7 @@ public static void initclr()
// So now we get the PythonEngine and execute the InitExt method on it.
var pythonEngineType = pythonRuntime.GetType("Python.Runtime.PythonEngine");

#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
return (IntPtr)pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null);
#else
pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/classbase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public virtual IntPtr type_subscript(IntPtr idx) {
//====================================================================
// Standard comparison implementation for instances of reflected types.
//====================================================================
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) {
if (op != Runtime.Py_EQ && op != Runtime.Py_NE)
{
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result,
return true;

case TypeCode.Int32:
#if !(PYTHON32 || PYTHON33 || PYTHON34)
#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
// Trickery to support 64-bit platforms.
if (IntPtr.Size == 4) {
op = Runtime.PyNumber_Int(value);
Expand Down Expand Up @@ -456,7 +456,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result,
return true;

case TypeCode.Byte:
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType))
{
if (Runtime.PyBytes_Size(value) == 1)
Expand Down Expand Up @@ -496,7 +496,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result,
return true;

case TypeCode.SByte:
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) {
if (Runtime.PyBytes_Size(value) == 1) {
op = Runtime.PyBytes_AS_STRING(value);
Expand Down Expand Up @@ -534,7 +534,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result,
return true;

case TypeCode.Char:
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) {
if (Runtime.PyBytes_Size(value) == 1) {
op = Runtime.PyBytes_AS_STRING(value);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/delegateobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) {
//====================================================================
// Implements __cmp__ for reflected delegate types.
//====================================================================
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static new IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) {
if (op != Runtime.Py_EQ && op != Runtime.Py_NE)
{
Expand Down
14 changes: 7 additions & 7 deletions src/runtime/exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class ExceptionClassObject : ClassObject {
internal ExceptionClassObject(Type tp) : base(tp) {
}

#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
internal static Exception ToException(IntPtr ob) {
CLRObject co = GetManagedObject(ob) as CLRObject;
if (co == null) {
Expand Down Expand Up @@ -114,7 +114,7 @@ public static IntPtr tp_getattro(IntPtr ob, IntPtr key)

return Runtime.PyObject_GenericGetAttr(ob, key);
}
#endif // (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34)
#endif // (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
}

/// <summary>
Expand All @@ -136,7 +136,7 @@ private Exceptions() {}
//===================================================================

internal static void Initialize() {
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
exceptions_module = Runtime.PyImport_ImportModule("builtins");
#else
exceptions_module = Runtime.PyImport_ImportModule("exceptions");
Expand Down Expand Up @@ -572,15 +572,15 @@ internal static IntPtr RaiseTypeError(string message) {
puplic static variables on the Exceptions class filled in from
the python class using reflection in Initialize() looked up by
name, not posistion. */
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static IntPtr BaseException;
#endif
public static IntPtr Exception;
public static IntPtr StopIteration;
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static IntPtr GeneratorExit;
#endif
#if !(PYTHON32 || PYTHON33 || PYTHON34)
#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static IntPtr StandardError;
#endif
public static IntPtr ArithmeticError;
Expand Down Expand Up @@ -637,7 +637,7 @@ puplic static variables on the Exceptions class filled in from
public static IntPtr SyntaxWarning;
public static IntPtr RuntimeWarning;
public static IntPtr FutureWarning;
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
public static IntPtr ImportWarning;
public static IntPtr UnicodeWarning;
//PyAPI_DATA(PyObject *) PyExc_BytesWarning;
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/importhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class ImportHook {
static CLRModule root;
static MethodWrapper hook;

#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
static IntPtr py_clr_module;
static IntPtr module_def;
#endif
Expand All @@ -38,7 +38,7 @@ internal static void Initialize() {
// but it provides the most "Pythonic" way of dealing with CLR
// modules (Python doesn't provide a way to emulate packages).
IntPtr dict = Runtime.PyImport_GetModuleDict();
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
IntPtr mod = Runtime.PyImport_ImportModule("builtins");
py_import = Runtime.PyObject_GetAttrString(mod, "__import__");
#else
Expand All @@ -51,7 +51,7 @@ internal static void Initialize() {

root = new CLRModule();

#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
// create a python module with the same methods as the clr module-like object
module_def = ModuleDefOffset.AllocModuleDef("clr");
py_clr_module = Runtime.PyModule_Create2(module_def, 3);
Expand All @@ -78,7 +78,7 @@ internal static void Initialize() {
//===================================================================

internal static void Shutdown() {
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
if (0 != Runtime.Py_IsInitialized()) {
Runtime.Decref(py_clr_module);
Runtime.Decref(root.pyHandle);
Expand All @@ -100,7 +100,7 @@ internal static void Shutdown() {
//===================================================================
public static IntPtr GetCLRModule(IntPtr? fromList=null) {
root.InitializePreload();
#if (PYTHON32 || PYTHON33 || PYTHON34)
#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
// update the module dictionary with the contents of the root dictionary
root.LoadNames();
IntPtr py_mod_dict = Runtime.PyModule_GetDict(py_clr_module);
Expand Down
Loading