Commit 8773be45 authored by Tres Seaver's avatar Tres Seaver

Merge pull request #1 from zopefoundation/tomgross-python3

Python 3 compatibility
parents f24a97cb e06c6daf
......@@ -3,8 +3,10 @@ build
dist
lib
parts
develop-eggs
*.dll
*.pyc
*.pyo
*.so
.installed.cfg
language: python
python:
- 2.7
- 3.2
- 3.3
install:
- python bootstrap.py
- bin/buildout
......
Changelog
=========
2.12.3 - unreleased
2.13.0 - unreleased
-------------------
- Python 3 compatibility
2.12.2 - 2012-10-14
-------------------
......
This diff is collapsed.
......@@ -5,3 +5,4 @@ parts = test
[test]
recipe = zc.recipe.testrunner
eggs = tempstorage
......@@ -16,22 +16,33 @@
from setuptools import setup, find_packages
long_description = file("README.txt").read() + "\n" + \
file("CHANGES.txt").read()
long_description = open("README.txt").read() + "\n" + \
open("CHANGES.txt").read()
setup(name='tempstorage',
version = '2.12.3dev',
version = '2.13.dev0',
url='http://pypi.python.org/pypi/tempstorage',
license='ZPL 2.1',
description='A RAM-based storage for ZODB',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
long_description=long_description,
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: CPython",
],
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[
'setuptools',
'ZODB3 >= 3.9.0',
'ZODB',
'zope.testing',
],
include_package_data=True,
......
......@@ -116,7 +116,8 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
def _clear_temp(self):
now = time.time()
if now > (self._last_cache_gc + self._conflict_cache_gcevery):
for k, v in self._conflict_cache.items():
temp_cc = self._conflict_cache.copy()
for k, v in temp_cc.items():
data, t = v
if now > (t + self._conflict_cache_maxage):
del self._conflict_cache[k]
......@@ -253,7 +254,6 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
references = {}
for roid in referencesl:
references[roid] = 1
referenced = references.has_key
# Create a reference count for this object if one
# doesn't already exist
......@@ -265,7 +265,7 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
# object
roids = oreferences.get(oid, [])
for roid in roids:
if referenced(roid):
if roid in references:
# still referenced, so no need to update
# remove it from the references dict so it doesn't
# get "added" in the next clause
......@@ -368,13 +368,12 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
self._lock_acquire()
try:
rindex = {}
referenced = rindex.has_key
rootl = ['\0\0\0\0\0\0\0\0']
# mark referenced objects
while rootl:
oid = rootl.pop()
if referenced(oid):
if oid in rindex:
continue
p = self._opickle[oid]
referencesf(p, rootl)
......@@ -382,7 +381,7 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
# sweep unreferenced objects
for oid in self._index.keys():
if not referenced(oid):
if not oid in rindex:
self._takeOutGarbage(oid)
finally:
self._lock_release()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment