praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.
http://praw.readthedocs.io/
BSD 2-Clause "Simplified" License
3.4k stars 453 forks source link

submission.comment_sort not working with replace_more #1952

Closed cmurg closed 1 year ago

cmurg commented 1 year ago

Describe the Bug

When retrieving comments on a submission, when I set submission.comment_sort = "new" before calling submission.comments.replace_more(), the full list of comments is not sorted. However comment_sort can't be set after replace_more, as the comments have already been fetched by then.

Desired Result

For all comments to be sorted even when using replace_more().

Code to reproduce the bug

import praw
import datetime

submission = reddit.submission('12ol3u0')

submission.comment_sort = "new"

submission.comments.replace_more(limit=None)

comments = submission.comments.list()

for c in comments:
    print(f"{c.id}: {datetime.datetime.utcfromtimestamp(c.created)}")

The Reddit() initialization in my code example does not include the following parameters to prevent credential leakage:

client_secret, password, or refresh_token.

Relevant Logs

jglhzvi: 2023-04-17 11:04:37
jglh58r: 2023-04-17 10:54:21
jgldqzo: 2023-04-17 10:09:59
jgl6p6b: 2023-04-17 08:25:11
jgl6nla: 2023-04-17 08:24:32
jgjxpq7: 2023-04-17 00:54:13
jgjv0nr: 2023-04-17 00:34:02
jgjuw6a: 2023-04-17 00:33:06
jgjq1ut: 2023-04-16 23:58:07
jgjksem: 2023-04-16 23:17:14
jgj8nv6: 2023-04-16 21:46:47
jgj5z6s: 2023-04-16 21:28:18
jgj5exk: 2023-04-16 21:24:35
jgj4ha4: 2023-04-16 21:18:01
jgj48o7: 2023-04-16 21:16:22
jgj44oo: 2023-04-16 21:15:39
jgizujx: 2023-04-16 20:46:26
jgize4v: 2023-04-16 20:43:16
jgixfou: 2023-04-16 20:29:53
jgivky8: 2023-04-16 20:17:24
jgiui70: 2023-04-16 20:10:12
jgittb3: 2023-04-16 20:05:32
jgit8xp: 2023-04-16 20:01:40
jgisbn3: 2023-04-16 19:55:17
jgir95j: 2023-04-16 19:48:02
jgimf84: 2023-04-16 19:14:53
jglifpt: 2023-04-17 11:09:52
jgl9g5q: 2023-04-17 09:07:16
jglea0w: 2023-04-17 10:17:18
jgl0nvl: 2023-04-17 06:59:43
jglxcyx: 2023-04-17 13:29:53
jgktotd: 2023-04-17 05:35:12
jgk1zo4: 2023-04-17 01:26:51
jgl1t9n: 2023-04-17 07:15:01
jgj1i8n: 2023-04-16 20:57:45
jgj30qd: 2023-04-16 21:08:03
jgiu4s4: 2023-04-16 20:07:43
jglv5ns: 2023-04-17 13:12:00
jgjia4r: 2023-04-16 22:58:07
jglyp0y: 2023-04-17 13:40:22
jgje6gq: 2023-04-16 22:27:11
jgiydin: 2023-04-16 20:36:21
jglrx7b: 2023-04-17 12:44:37
jgj4by9: 2023-04-16 21:17:00
jgiusku: 2023-04-16 20:12:07
jgm3oyu: 2023-04-17 14:18:13
jglg4yu: 2023-04-17 10:41:52
jgl9lcn: 2023-04-17 09:09:24
jgl7f7h: 2023-04-17 08:36:18
jgj6w9q: 2023-04-16 21:34:26
jgj3mnb: 2023-04-16 21:12:17
jgl0qva: 2023-04-17 07:00:48
jgivee5: 2023-04-16 20:16:11
jglvbdk: 2023-04-17 13:13:19
jgljny2: 2023-04-17 11:23:45
jglvmn2: 2023-04-17 13:15:55
jgl9ha1: 2023-04-17 09:07:45
jgl7pgf: 2023-04-17 08:40:33
jgjblkb: 2023-04-16 22:08:08
jgj3t7p: 2023-04-16 21:13:33
jglw564: 2023-04-17 13:20:07
jglon82: 2023-04-17 12:14:33
jgje4kp: 2023-04-16 22:26:48
jgjdi2j: 2023-04-16 22:22:09
jglixah: 2023-04-17 11:15:30
jgj6wk8: 2023-04-16 21:34:29
jglv9rf: 2023-04-17 13:12:57

This code has previously worked as intended.

No

Operating System/Environment

macOS Monterey Version 12.6

Python Version

Python 3.9.16

PRAW Version

7.7.0

Prawcore Version

2.3.0

Anything else?

No response

LilSpazJoekp commented 1 year ago

PRAW does not handle sorting. This is all done on Reddit's side. Their more_comments API has been rewritten recently and this might be a bug related to it.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stale for 30 days with no activity.