mirror of
				https://github.com/django/django.git
				synced 2025-11-04 13:39:16 +00:00 
			
		
		
		
	Fix the dispatch test GC code under PyPy, and make the comment for Jython better.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17322 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		
							parent
							
								
									b9910bddd2
								
							
						
					
					
						commit
						1aaa0dd098
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -8,9 +8,16 @@ from django.utils import unittest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if sys.platform.startswith('java'):
 | 
					if sys.platform.startswith('java'):
 | 
				
			||||||
    def garbage_collect():
 | 
					    def garbage_collect():
 | 
				
			||||||
        """Run the garbage collector and wait a bit to let it do his work"""
 | 
					        # Some JVM GCs will execute finalizers in a different thread, meaning
 | 
				
			||||||
 | 
					        # we need to wait for that to complete before we go on looking for the
 | 
				
			||||||
 | 
					        # effects of that.
 | 
				
			||||||
        gc.collect()
 | 
					        gc.collect()
 | 
				
			||||||
        time.sleep(0.1)
 | 
					        time.sleep(0.1)
 | 
				
			||||||
 | 
					elif hasattr(sys, "pypy_version_info"):
 | 
				
			||||||
 | 
					    def garbage_collect():
 | 
				
			||||||
 | 
					        # Collecting weakreferences can take two collections on PyPy.
 | 
				
			||||||
 | 
					        gc.collect()
 | 
				
			||||||
 | 
					        gc.collect()
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
    def garbage_collect():
 | 
					    def garbage_collect():
 | 
				
			||||||
        gc.collect()
 | 
					        gc.collect()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue