Skip to content

Commit

Permalink
Merge pull request #13 from praw-dev/comment_parent
Browse files Browse the repository at this point in the history
Possible fix for #11
  • Loading branch information
LilSpazJoekp authored Oct 2, 2020
2 parents 4a04d39 + 2f9c627 commit d9b61d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Unreleased

**Fixed**

* A bug where if you call `.parent()` on a comment it clears its replies.
* An issue where performing a deepcopy on an :class:`.RedditBase` object will fail.

7.1.0 (2020/07/16)
Expand Down
8 changes: 6 additions & 2 deletions asyncpraw/models/reddit/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,12 @@ async def parent(self) -> Union["Comment", "Submission"]:
"""
# pylint: disable=no-member

await self._fetch()
await self.submission._fetch()
if not self._fetched:
await self._fetch()

if not self.submission._fetched:
await self.submission._fetch()

if self.parent_id == self.submission.fullname:
return self.submission

Expand Down

0 comments on commit d9b61d3

Please sign in to comment.