Skip to content

Commit 17dca5c

Browse files
committed
Revert "PYTHON-1915: Prohibit copying ClientSession objects (#480)"
This reverts commit 959039b.
1 parent 30523d2 commit 17dca5c

File tree

3 files changed

+0
-9
lines changed

3 files changed

+0
-9
lines changed

doc/contributors.rst

-1
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,3 @@ The following is a list of people who have contributed to
8888
- Terence Honles (terencehonles)
8989
- Paul Fisher (thetorpedodog)
9090
- Julius Park (juliusgeo)
91-
- Ishmum Jawad Khan (ishmum123)

pymongo/client_session.py

-3
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,6 @@ def _start_retryable_write(self):
827827
self._check_ended()
828828
self._server_session.inc_transaction_id()
829829

830-
def __copy__(self):
831-
raise TypeError('A ClientSession cannot be copied, create a new session instead')
832-
833830

834831
class _ServerSession(object):
835832
def __init__(self, generation):

test/test_session.py

-5
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,6 @@ def drop_db():
779779

780780
wait_until(drop_db, 'dropped database after w=0 writes')
781781

782-
def test_session_not_copyable(self):
783-
client = self.client
784-
with client.start_session() as s:
785-
self.assertRaises(TypeError, lambda: copy.copy(s))
786-
787782

788783
class TestCausalConsistency(unittest.TestCase):
789784

0 commit comments

Comments
 (0)