Skip to content

Commit

Permalink
Add _dt_reconstructor function introduced in DateTime 2.12.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Sep 17, 2012
1 parent 2f66a27 commit fe81af1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 8 additions & 7 deletions CHANGES.txt
@@ -1,10 +1,16 @@
Changelog
=========

3.1 (unreleased)
----------------
3.0.1 (unreleased)
------------------

- Add `_dt_reconstructor` function introduced in DateTime 2.12.7 to provide
forward compatibility with pickles that might reference this function.

3.0 (2011-12-09)
----------------

- No changes.

Backwards compatibility of DateTime 3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -26,11 +32,6 @@ calling its `micros()` methods. DateTime is not particular well suited to be
used in comparing timestamps of file systems - use the time and datetime objects
from the Python standard library instead.

3.0 (2011-12-09)
----------------

- No changes.

3.0b3 (2011-10-19)
------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -16,7 +16,7 @@
from setuptools import setup, find_packages

setup(name='DateTime',
version = '3.1dev',
version = '3.0.1dev',
url='http://pypi.python.org/pypi/DateTime',
license='ZPL 2.1',
description="""\
Expand Down
13 changes: 13 additions & 0 deletions src/DateTime/DateTime.py
Expand Up @@ -11,6 +11,7 @@
#
##############################################################################

import copy_reg
import math
import re
from time import altzone
Expand Down Expand Up @@ -1907,3 +1908,15 @@ def encode(self, out):
out.write('<value><dateTime.iso8601>')
out.write(self.ISO8601())
out.write('</dateTime.iso8601></value>\n')


# Provide the _dt_reconstructor function here, in case something
# accidentally creates a reference to this function

orig_reconstructor = copy_reg._reconstructor


def _dt_reconstructor(cls, base, state):
if cls is DateTime:
return cls(state)
return orig_reconstructor(cls, base, state)

0 comments on commit fe81af1

Please sign in to comment.