diff --git a/Lib/decimal.py b/Lib/decimal.py
index 7842cb25071..2c97dbd0b32 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -540,21 +540,47 @@ class Decimal(object):
# digits.
self = object.__new__(cls)
- self._is_special = False
- # From an internal working value
- if isinstance(value, _WorkRep):
- self._sign = value.sign
- self._int = str(value.int)
- self._exp = int(value.exp)
- return self
+ # From a string
+ # REs insist on real strings, so we can too.
+ if isinstance(value, str):
+ m = _parser(value)
+ if m is None:
+ if context is None:
+ context = getcontext()
+ return context._raise_error(ConversionSyntax,
+ "Invalid literal for Decimal: %r" % value)
- # From another decimal
- if isinstance(value, Decimal):
- self._exp = value._exp
- self._sign = value._sign
- self._int = value._int
- self._is_special = value._is_special
+ if m.group('sign') == "-":
+ self._sign = 1
+ else:
+ self._sign = 0
+ intpart = m.group('int')
+ if intpart is not None:
+ # finite number
+ fracpart = m.group('frac')
+ exp = int(m.group('exp') or '0')
+ if fracpart is not None:
+ self._int = (intpart+fracpart).lstrip('0') or '0'
+ self._exp = exp - len(fracpart)
+ else:
+ self._int = intpart.lstrip('0') or '0'
+ self._exp = exp
+ self._is_special = False
+ else:
+ diag = m.group('diag')
+ if diag is not None:
+ # NaN
+ self._int = diag.lstrip('0')
+ if m.group('signal'):
+ self._exp = 'N'
+ else:
+ self._exp = 'n'
+ else:
+ # infinity
+ self._int = '0'
+ self._exp = 'F'
+ self._is_special = True
return self
# From an integer
@@ -565,6 +591,23 @@ class Decimal(object):
self._sign = 1
self._exp = 0
self._int = str(abs(value))
+ self._is_special = False
+ return self
+
+ # From another decimal
+ if isinstance(value, Decimal):
+ self._exp = value._exp
+ self._sign = value._sign
+ self._int = value._int
+ self._is_special = value._is_special
+ return self
+
+ # From an internal working value
+ if isinstance(value, _WorkRep):
+ self._sign = value.sign
+ self._int = str(value.int)
+ self._exp = int(value.exp)
+ self._is_special = False
return self
# tuple/list conversion (possibly from as_tuple())
@@ -616,48 +659,6 @@ class Decimal(object):
raise TypeError("Cannot convert float to Decimal. " +
"First convert the float to a string")
- # From a string
- # REs insist on real strings, so we can too.
- if isinstance(value, str):
- m = _parser(value)
- if m is None:
- if context is None:
- context = getcontext()
- return context._raise_error(ConversionSyntax,
- "Invalid literal for Decimal: %r" % value)
-
- if m.group('sign') == "-":
- self._sign = 1
- else:
- self._sign = 0
- intpart = m.group('int')
- if intpart is not None:
- # finite number
- fracpart = m.group('frac')
- exp = int(m.group('exp') or '0')
- if fracpart is not None:
- self._int = (intpart+fracpart).lstrip('0') or '0'
- self._exp = exp - len(fracpart)
- else:
- self._int = intpart.lstrip('0') or '0'
- self._exp = exp
- self._is_special = False
- else:
- diag = m.group('diag')
- if diag is not None:
- # NaN
- self._int = diag.lstrip('0')
- if m.group('signal'):
- self._exp = 'N'
- else:
- self._exp = 'n'
- else:
- # infinity
- self._int = '0'
- self._exp = 'F'
- self._is_special = True
- return self
-
raise TypeError("Cannot convert %r to Decimal" % value)
def _isnan(self):
diff --git a/PC/dl_nt.c b/PC/dl_nt.c
index a87b523818a..e143c780ac4 100644
--- a/PC/dl_nt.c
+++ b/PC/dl_nt.c
@@ -11,6 +11,7 @@ forgotten) from the programmer.
#include "Python.h"
#include "windows.h"
+#ifdef Py_ENABLE_SHARED
char dllVersionBuffer[16] = ""; // a private buffer
// Python Globals
@@ -35,3 +36,5 @@ BOOL WINAPI DllMain (HANDLE hInst,
}
return TRUE;
}
+
+#endif /* Py_ENABLE_SHARED */
diff --git a/PCbuild9/debug.vsprops b/PCbuild9/debug.vsprops
new file mode 100644
index 00000000000..59acd909749
--- /dev/null
+++ b/PCbuild9/debug.vsprops
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/PCbuild9/make_buildinfo.vcproj b/PCbuild9/make_buildinfo.vcproj
index 8ba5c49a9e2..c42229c1a0a 100644
--- a/PCbuild9/make_buildinfo.vcproj
+++ b/PCbuild9/make_buildinfo.vcproj
@@ -22,7 +22,7 @@
@@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -119,7 +119,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -275,7 +275,7 @@
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="_DEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="3"
/>
@@ -349,7 +349,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -424,7 +424,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -499,7 +499,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -574,7 +574,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
AdditionalIncludeDirectories="..\Python;..\Modules\zlib"
- PreprocessorDefinitions="NDEBUG;USE_DL_EXPORT;_USRDLL"
+ PreprocessorDefinitions="_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED"
RuntimeLibrary="2"
/>
@@ -92,7 +92,7 @@
@@ -117,7 +117,7 @@
Optimization="0"
EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories=""
- PreprocessorDefinitions="_DEBUG;_WINDOWS"
+ PreprocessorDefinitions="_WINDOWS"
RuntimeLibrary="3"
CompileAs="0"
/>
@@ -163,7 +163,7 @@
@@ -185,7 +185,7 @@
@@ -257,7 +257,7 @@
@@ -327,7 +327,7 @@
@@ -400,7 +400,7 @@
@@ -472,7 +472,7 @@
@@ -545,7 +545,7 @@
+
+
+
diff --git a/PCbuild9/w9xpopen.vcproj b/PCbuild9/w9xpopen.vcproj
index d00cef4def8..2397366b792 100644
--- a/PCbuild9/w9xpopen.vcproj
+++ b/PCbuild9/w9xpopen.vcproj
@@ -21,7 +21,7 @@
@@ -86,7 +85,7 @@
@@ -152,7 +150,7 @@